Lack of pipe method?
See original GitHub issuei installed sharp module based on the ‘Read Me’ document, simple test is ok, but i get the below error when excute my test code, lack of importing some other module?
My Ubuntu env(Ubuntu 14.04 LTS)
uname -a
Linux mao 3.13.0-34-generic #60-Ubuntu SMP Wed Aug 13 15:45:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Test Code:
var sharp = require('sharp');
var http = require('http');
require('stream');
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'image/webp'});
sharp('input.jpg').rotate().resize(200).webp().pipe(response);
}).listen(8000);
// Create HTTP server that always returns auto-rotated 'input.jpg',
// resized to 200 pixels wide, in WebP format
The error log:
sharp('input.jpg').rotate().resize(200).webp().pipe(response);
^
TypeError: Object [object Promise] has no method 'pipe'
at Server.<anonymous> (/home/len/temp/nodejis/webp.js:10:50)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:527:27)
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_lookup: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
(.:6385): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Losses in Pipes - Mechanical and Materials Engineering
This page provides a quick review of piping losses, starting with Bernoulli's Equation. The basic approach to all piping systems is to write...
Read more >Equivalent Length Method - Minor Pressure Loss in Piping ...
An efficient and simple way to calculate the pressure loss in a piping system is the "Equivalent Pipe Length Method".
Read more >Experiment #4: Energy Loss in Pipes - Mavs Open Press
The total energy loss in a pipe system is the sum of the major and minor losses ... Method. The friction factor is...
Read more >Pipe Friction Loss Calculations - Pipe Flow Software
Calculating the friction loss in a pipe using the Darcy-Weisbach method.
Read more >Pressure Loss from Fittings - Equivalent Length Method
The equivalent length method (L/D ratio) allows the user to describe the pressure drop through a fitting as a length of pipe. In...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
http.get()
returns a request object rather than a Readable Stream response.I recommend you use the request HTTP client.
You’ll need to move
inputStream
andtransformer
inside the scope of the closure passed tocreateServer()
.Thanks, the test above is ok after reinstalling the sharp; but another problem when i replace input.jpg to stream, the HTTP request from browser can not return, the code is below: