Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I use DecompressionStream() to decompress the Node.js nightly release before extracting only the node executable from the tar archive https://github.com/guest271314/download-node-nightly-executable/blob/main/index.html.
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'); }
Related posts
- The massive bug at the heart of the npm ecosystem
- How to Install Node.js on Ubuntu 22.04 LTS | Configure Node.js and NPM |...
- [AskJS] What is your preferred solution to share and execute Node.js scripts ?
- PSA: It is possible to run node executable without npm, node_modules, or package.json
- Alternatives to local Node+npm dev environment? No admin rights. Unable to install dependencies over network.