You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't get why this simple code snippet does not work.
I'm sure this is some kind of nodejs stream thing, but reading the docs of file-type i just expected this to work:
constgot=require('got');constFileType=require('file-type');consturl='https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';(async()=>{constsource=got.stream(url);console.log(awaitFileType.stream(source));// ( ↑ should do something with the stream instead of logging it)})();
Result
(node:31937) UnhandledPromiseRejectionWarning: Error: Failed to pipe. The response has been emitted already.
at DuplexWrapper.proxy.pipe (/home/fiws/hydra/pot-api/node_modules/got/dist/source/as-stream.js:98:19)
at pipe (internal/streams/pipeline.js:54:15)
at Array.reduce (<anonymous>)
at Function.pipeline (internal/streams/pipeline.js:94:18)
at DuplexWrapper.<anonymous> (/home/fiws/hydra/pot-api/node_modules/file-type/core.js:1290:26)
at Object.onceWrapper (events.js:427:28)
at DuplexWrapper.emit (events.js:321:20)
at emitReadable_ (_stream_readable.js:577:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
(node:31937) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:31937) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The text was updated successfully, but these errors were encountered:
I don't get why this simple code snippet does not work.
I'm sure this is some kind of nodejs stream thing, but reading the docs of file-type i just expected this to work:
Result
The text was updated successfully, but these errors were encountered: