A set of Bucklescript bindings for JSZip.
Required bindings for Blob are also included.
You can find a example usage of theses bindings in the ElpIDE project : source || demo
let readZip = f =>
/* Locally open zip module */
Zip.(
create()
/* Load from blob */
|. loadAsync(`blob(f))
|> Js.Promise.then_(zip => {
zip
|. forEach((_relativePath, zipEntry) =>
zipEntry
/* Read each file in zip */
|. Object.asyncString()
|> Js.Promise.then_(content => {
/* Do something */
Js.log(content);
Js.Promise.resolve(content);
})
|> ignore;
);
Js.Promise.resolve(zip);
})
|> ignore
);
949: <UNKNOWN SYNTAX ERROR>
These binding are not complete but in a very usable state. Please fill a issue or make a pull request if there are feature you miss !
To use these bindings in an existing ReasonReact project simply add the repository to your dependencies :
yarn add "https://github.com/voodoos/bs-jszip"
And ask bsb
to use it by adding bs-jszip
to bs-dependencies
in your bsconfig.json
.
All contributions are welcomed.
MIT (see LICENSE file for more details)