Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

requirejs-memfiles

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requirejs-memfiles

`requirejs` is a great tool for building JS bundles. But, it doesn't process already in-memory files.

  • 2.1.15-2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Why requirejs-memfiles?

requirejs is a great tool for building JS bundles. But, it doesn't process already in-memory files.

requirejs-memfiles is requirejs with an additional static method requirejs.setFiles() that allows for passing in-memory files. It's ideal for applications that builds bundles on the fly.

Usage

npm install requirejs-memfiles

var fs = require( "js" );
var requirejs = require( "requirejs-memfiles" );

var files = {
  "main.js": fs.readFileSync( "./main.js" ),
  ...
}

requirejs.setFiles( files );
requirejs.optimize({
  appDir: ".",
  baseUrl: ".",
  dir: "dist",
  modules: [{
      name: "output",
      include: "main",
      create: true
  }]
}, function() {
  var output = files[ "dist/output.js" ];
  ...

}, function( error ) {
  // handle error
  ...

});

API

  • requirejs.setFiles( files )

files Object containing (path, data) key-value pairs, e.g.:

{
   <path-of-file-1>: <data-of-file-1>,
   <path-of-file-2>: <data-of-file-2>,
   ...
}

Test

npm test

License

MIT © Rafael Xavier de Souza

FAQs

Package last updated on 06 Feb 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc