
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
OOAFS allows you to manipulate the FileSystem in an object-oriented fashion, by using objects to represent FS entries (like Java's File class) and promises instead of the old callbacks. This way, you don't have to spend your time concatenating paths and manually filtering files. Here's a little preview of what can be done:
let themesFolder = new Entry("./plugins/").d; let themes = await themesFolder.list({ type: EntryType.DIRECTORY }); for (let themeFolder of themes) { const manifestFile = themeFolder.child('manifest.json'); if (!await manifestFile.exists()) continue; const manifest = JSON.parse(await manifestFile.read('utf8')); const iconStream = themeFolder.child('icon.png').createReadStream(); loadTheme(manifest.name, iconStream, themeFolder); }
npm install ooafs
import { Entry, File, Directory } from 'ooafs';
// Create a file wrapper
const file: File = new Entry("./path/file.txt");
Entryis a class, whileFileandDirectoryare interfaces implemented by this class. These interfaces can be used for a better type-safety
The library is completely typed, so as long as you use a relatively good editor like VSCode, you shouldn't have much problems finding the available methods and properties.
function backupNodeProject(project: Directory, backupFolder: Directory) {
// `name` is the basename of the project folder
const backup = backupFolder.child(project.name);
project.copy(backup);
// Delete 20Gb of useless data !
backup.child("node_modules").remove();
}
import { Directory, EntryFilter } from 'ooafs';
const filter: EntryFilter = {
extensions: ['.png', '.jpeg', '.jpg', '.bmp'],
// Custom filtering function
async filter(image) {
return (await image.size()) > 1023;
}
};
// const picturesDir: Directory = new Entry("pictures");
// is the same as:
const picturesDir = new Entry("pictures").d;
const images = await picturesDir.listRecursively(filter);
ooafs in entirely written in TypeScript and thus, is completely typed. In addition to that, when you import the module, you can use two interfaces, File and Directory to mask out methods that are not related to files and directories, respectively:
import { Entry, File, Directory } from 'ooafs';
const file: File = new Entry("/path");
// This shows an error: File doesn't have a `list` method
file.list();
Instead of manually casting your Entry instance to one of the two interfaces, you can also use a specifically made getter:
import { Entry } from 'ooafs';
// Add `.f` behind the constructor expression
// file is now typed as `File`
const file = new Entry("/path").f;
// This shows an error: File doesn't have a `list` method
file.list();
Three are available: .e, .d and .f.
If you notice any bug or have a suggestion, please tell me about it in the issues, it will help everyone!
Tests are created with mocha and asserted with chai.expect.
You can run the suite using
npm test
ooafs is licensed under the very permissive MIT License. You may use it for commercial projects if you comply to the license.
FAQs
Type-safe Object-Oriented Async FileSystem
The npm package ooafs receives a total of 9 weekly downloads. As such, ooafs popularity was classified as not popular.
We found that ooafs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.