File
File metadata object for use in Fractal
const File = require('@frctl/file');
const file = new File({
base: '/components',
path: '/components/patterns/_04-button--large.hbs',
contents: new Buffer('<button class="button button--large">{{ buttonText }}</button>')
});
console.log(file.stem); // '_04-button--large'
console.log(file.relative); // 'patterns/_04-button--large.hbs
const fromRealFile = File.from('/path/to/file.js', {base: '/path'}).then(file => {
console.log(file.contents);
});
Install
npm i @frctl/file --save
Requirements
@frctl/file
requires Node >= v6.0