@coder/requirefs
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @coder/requirefs

Weekly Downloads

6

Version

1.1.5

License

MIT

Unpacked Size

3.29 MB

Total Files

39

Last publish

Collaborators

  • kiracoder
  • bruno.quaresma
  • coderhq
  • kylecarbs
  • coderasher
  • nhooyr
  • ammarb