Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including o7 with all npm packages installed. Try it out:

var o7 = require("o7")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

o7 v1.1.0

tiny file processor


tiny file processor


npm i o7


const o7 = require('o7')

function middleware (files) { => file.contents.concat('\nhello!'))

o7([middleware], 'destination/').then(() => {
  // success!


Takes an array of middleware functions that each receive a files argument, which is an array of vfiles. Middleware functions don't need to return anything, they can modify the files array in-place. Middleware runs in the order it's defined in.

DESTINATION can be an absolute or relative path to where the modified files should be outputted to.

OPTIONS is an optional object that can have two keys:

  • source: Where to read files from. Default is process.cwd()
  • exclude: An array of files or directories to exclude. Must be strings.
  • noRead: Doesn't read from disk, provides an empty files array instead.
  • noWrite: Doesn't write to disk.

Returns a promise with the processed files as its argument when finished writing.


AGPL 3.0 (see LICENSE)


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free