Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/file.js')
-rw-r--r--lib/file.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index 3e75091..d9a10e0 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -7,6 +7,7 @@ const streamToBlob = require('stream-to-blob')
const streamToBlobURL = require('stream-to-blob-url')
const streamToBuffer = require('stream-with-known-length-to-buffer')
const FileStream = require('./file-stream')
+const queueMicrotask = require('queue-microtask')
class File extends EventEmitter {
constructor (torrent, file) {
@@ -81,7 +82,7 @@ class File extends EventEmitter {
createReadStream (opts) {
if (this.length === 0) {
const empty = new PassThrough()
- process.nextTick(() => {
+ queueMicrotask(() => {
empty.end()
})
return empty