intercepticon-npm
v1.0.4
Published
Simple file packager that intercepts the node:fs api when you use it as the fs api, you can use the same code with and without Intercepticon.
Downloads
11
Maintainers
Readme
Intercepticon
Intercepticon is a free and open-source virtual "filesystem" wrapper for NodeJS. It uses its own .inc format. It does NOT support folders.
Installation
Run this in the command-line:
npm i intercepticon-npm
Usage
Here is a demo with all the APIs used:
var Intercepticon = require('intercepticon-npm')
var fs = new Intercepticon(__dirname + '/test.inc')
console.log(fs.readdirSync())
fs.writeFileSync('test.txt', 'Hi.')
console.log(fs.readdirSync())
console.log(`Test file exists: `+fs.existsSync('test.txt'))
console.log(fs.readFileSync('test.txt'))
setTimeout(() => {
fs.unlinkSync('test.txt')
console.log(fs.readdirSync())
console.log(`Test file exists: `+fs.existsSync('test.txt'))
}, 7000)
Why is "filesystem" in quotes?
It's because that is NOT a real filesystem but something similar to ASAR