🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@coder/requirefs

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coder/requirefs

Create a readable and requirable file system from tars, zips, or a custom provider.

1.0.6
npm
Version published
Weekly downloads
6
-62.5%
Maintainers
3
Weekly downloads
 
Created
Source

requirefs

requirefs lets you create a readable and requirable file system from a custom file system provider. For example, you could use this to run a Node package on the browser by packing it into a tar and then loading that on the client through requirefs.

Everything passed to the file system provider will use / as path separators.

import { fromTar } from "./requirefs"

const response = await fetch(uri)
if (response.status !== 200) {
  throw new Error("failed to download")
}
const rfs = fromTar(new Uint8Array(await response.arrayBuffer()))
// Use rfs.provide() to provide any necessary modules.
rfs.require(".")

requirefs has no dependencies unless you use fromZip which requires jszip.

FAQs

Package last updated on 10 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts