Переглянути джерело

storage-node: createWriteStream is not async

Mokhtar Naamani 3 роки тому
батько
коміт
acfda6a0c7
1 змінених файлів з 3 додано та 10 видалено
  1. 3 10
      storage-node/packages/storage/storage.js

+ 3 - 10
storage-node/packages/storage/storage.js

@@ -336,22 +336,15 @@ class Storage {
 
     // Write stream
     if (mode === 'w') {
-      return await this.createWriteStream(contentId, timeout)
+      return this.createWriteStream(contentId, timeout)
     }
 
     // Read stream - with file type detection
     return await this.createReadStream(contentId, timeout)
   }
 
-  async createWriteStream() {
-    // IPFS wants us to just dump a stream into its storage, then returns a
-    // content ID (of its own).
-    // We need to instead return a stream immediately, that we eventually
-    // decorate with the content ID when that's available.
-    return new Promise((resolve) => {
-      const stream = new StorageWriteStream(this)
-      resolve(stream)
-    })
+  createWriteStream() {
+    return new StorageWriteStream(this)
   }
 
   async createReadStream(contentId, timeout) {