Fetch file listings and individual files from a remote ZIP file.
Without downloading the entire ZIP:
The gist of what the library does is:
ReadableStream
due to testing/dev difficultiespopulate()
to failyarn add @gyng/remote-zip
npm install --save @gyng/remote-zip
See the generated API documentation.
If using in the browser, the server will need to whitelist CORS for GET
, HEAD
, and the Range
header.
const url = new URL("http://www.example.com/test.zip");
const remoteZip = await new RemoteZipPointer({ url }).populate();
const fileListing = remoteZip.files(); // RemoteZipFile[]
const uncompressedBytes = await remoteZip.fetch("test.txt"); // ArrayBuffer
const method = "POST";
const additonalHeaders = new Headers();
additonalHeaders.append("X-Example", "foobar");
const url = new URL("http://www.example.com/test.zip");
const remoteZip = await new RemoteZipPointer({
url,
additionalHeaders,
method,
credentials: "include",
}).populate();
const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders);
yarn d
watch and buildyarn t:watch
watch and testyarn lint
yarn build
Run tests and checks with Docker
docker-compose -f docker-compose.test.yml up --build
Get an automation token from npm under settings
https://www.npmjs.com/settings/aicadium/tokens/
Add the token to your repository secrets.
https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/settings/secrets/actions/new
NPM_TOKEN
Create a new release.
https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/releases
The workflow at ./github/workflows/publish.yml
should run and publish your packages to both NPM and GitHub Packages.
Don't forget to bump your version number in package.json
before this.
Generated using TypeDoc