js-untar

Library for reading tar files in the browser. (by InvokIT)

Js-untar Alternatives

Similar projects and alternatives to js-untar

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better js-untar alternative or higher similarity.

js-untar reviews and mentions

Posts with mentions or reviews of js-untar. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-03-21.
  • JSON compression in the browser, with gzip and the Compression Streams API.
    2 projects | /r/javascript | 21 Mar 2023
    let [node_nightly_build] = await ( await fetch('https://nodejs.org/download/nightly/index.json') ).json(); let { version, files } = node_nightly_build; let node_nightly_url = `https://nodejs.org/download/nightly/${version}/node-${version}-${osArch}.tar.gz`; let url = `${cors_api_url}${node_nightly_url}`; console.log(`Fetching ${node_nightly_url}`); const request = (await fetch(url)).body.pipeThrough( new DecompressionStream('gzip') ); // Download gzipped tar file and get ArrayBuffer const buffer = await new Response(request).arrayBuffer(); // Decompress gzip using pako // Get ArrayBuffer from the Uint8Array pako returns // const decompressed = await pako.inflate(buffer); // Untar, js-untar returns a list of files // (See https://github.com/InvokIT/js-untar#file-object for details) const untarFileStream = new UntarFileStream(buffer); while (untarFileStream.hasNext()) { file = untarFileStream.next(); if (/\/bin\/node$/.test(file.name)) { break; } } writable = await fileSystemHandle.createWritable(); writer = writable.getWriter(); await writer.write(file.buffer); await writer.close(); new Notification('Download complete.', { body: `Successfully downloaded node executable ${version}` }); } catch (e) { console.log(e); } finally { console.log('Done'); }
  • What is a package you need, but it does not exist
    6 projects | /r/node | 13 Jun 2022
    } } try { // throws, see https://github.com/InvokIT/js-untar/issues/30, handle error // untar is still defined globally // await import('https://unpkg.com/[email protected]/build/dist/untar.js'); } catch (e) { console.log(e); } finally { // https://stackoverflow.com/a/65448758 // trying to avoid fetching files that won't be used let {default: [node_nightly_build]} = await import('https://nodejs.org/download/nightly/index.json', {assert:{type: 'json'}}); let {version, files} = node_nightly_build; let url = https://nodejs.org/download/nightly/${version}/node-${version}-linux-x64.tar.gz${get_file}; const request = ( await fetch( url ) ).body.pipeThrough(new DecompressionStream('gzip')); // Download gzipped tar file and get ArrayBuffer const buffer = await new Response(request).arrayBuffer(); // Decompress gzip using pako // Get ArrayBuffer from the Uint8Array pako returns // const decompressed = await pako.inflate(buffer); // Untar, js-untar returns a list of files // (See https://github.com/InvokIT/js-untar#file-object for details) const files = new UntarFileStream(buffer); while (files.hasNext()) { file = files.next(); if (//bin/node$/.test(file.name)) { break; } } writable = await fileSystemHandle.createWritable(); writer = writable.getWriter(); await writer.write(file.buffer); await writer.close(); console.log('Done'); } ```
  • What is the preferred way of installing NodeJS?
    8 projects | /r/node | 26 Mar 2022
    let fileSystemHandle = await showSaveFilePicker({suggestedName: 'node'}), writable, writer; await import('https://cdnjs.cloudflare.com/ajax/libs/pako/2.0.4/pako.min.js'); try { await import('https://unpkg.com/[email protected]/build/dist/untar.js'); } catch (e) { console.log(e); } finally { // https://stackoverflow.com/a/65448758 const request = await fetch('node-v16.14.2-linux-x64.tar.gz'); const buffer = await request.arrayBuffer(); // Download gzipped tar file and get ArrayBuffer const decompressed = await pako.inflate(buffer); // Decompress gzip using pako const files = await untar(decompressed.buffer); // Get ArrayBuffer from the Uint8Array pako returns, untar, js-untar returns a list of files (See https://github.com/InvokIT/js-untar#file-object for details) writable = await fileSystemHandle.createWritable(); writer = writable.getWriter(); const file = files.find( ({ name }) => name === 'node-v16.14.2-linux-x64/bin/node' ).buffer; await writer.write(file); await writer.close(); }
  • A note from our sponsor - SaaSHub
    www.saashub.com | 1 May 2024
    SaaSHub helps you find the best software and product alternatives Learn more →

Stats

Basic js-untar repo stats
3
71
0.0
about 1 year ago

InvokIT/js-untar is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of js-untar is JavaScript.


Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com