I was wondering how to use JavaScript to do async zip writing and reading.
相关问题
- Load script async?
- C# An asynchronous operation cannot be started at
- How to call firefox addon function with onclick in
- aio_write on linux with rtkaio is sometimes long
- await work in chrome console without async wrapper
相关文章
- With a Promise, why do browsers return a reject tw
- Asynchronous SHA256 Hashing
- Does aiohttp have ORM?
- Progressive web app(PWA) vs Electron vs Browser ex
- Can each Iteration of a for loop/for_each be done
- How does robospice manage activity lifecycle?
- How to call a async function from a synchronized c
- passing multiple arguments to promise resolution w
Here is an example for zip reading using nsIZipReader, zip writing goes in a similar way. The example reads a zip file from
/tmp/example.zip
and prints the content of the first file to the console.Remarks:
nsIInputStreamPump
for async I/O I found a reference to this API at the Streams guide on MDN. This interface offers a.asyncRead
method which takes an object that implementsnsIStreamListener
(andnsIRequestObserver
).console.time('foo');
before thereusableStreamInstance.init
invocation andconsole.timeEnd('foo');
afterreusableStreamInstance.readBytes
)..readBytes
instead of.read
to avoid truncation of data if the file contains a null byte.