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.
- Host: GitHub
- URL: https://github.com/drawbotics/file-wrapper
- Owner: Drawbotics
- License: mit
- Created: 2018-04-18T11:08:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T11:09:17.000Z (about 7 years ago)
- Last Synced: 2024-12-22T03:07:55.177Z (5 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).