Skip to content
forked from coder/requirefs

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

License

Notifications You must be signed in to change notification settings

coding/requirefs

 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.1%
  • JavaScript 2.9%