An open API service indexing awesome lists of open source software.

https://github.com/drawbotics/file-wrapper

A small class wrapping a node file to provide some common fields.
https://github.com/drawbotics/file-wrapper

Last synced: 2 months ago
JSON representation

A small class wrapping a node file to provide some common fields.

Awesome Lists containing this project

README

        

# File Wrapper

A small class wrapping a node file to provide some common fields.

## Usage Example

```javascript
const fs = require('fs-extra');
const File = require('file-wrapper');

async function main() {
const filePath = '/folder/file.txt';
const fileData = await fs.readFile(filePath);

const file = new File(filePath, fileData);

console.log(file.name); // file.txt
console.log(file.dir); // /folder
console.log(file.data); // file contents
console.log(file.path); // /folder/file.txt
}
```

## LICENSE

MIT. See [LICENSE](LICENSE).