fQuery
file selection and processing for Node.js
fQuery is a jQuery like lib to manage and manipulate files.
Getting started
First require fQuery:
var fQuery = require('fquery');
example usage
concat all JavaScript files under
src/
and savefQuery('src/*.js').concat().write('dist/all.js');
fQuery('src/*.js') .concat(';') .wrap('(function () {"use strict";', '}())') .write('dist/all.js');
fQuery
An fQuery object is an array-like object of Blobs. It has a property length
and the associated indeces are referencing the Blobs. You can create fQuery objects through the main factory function fQuery()
.
A Blob stores information about a file, that might be real or virtual, with readable or binary content.
fQuery()
// select files and read their content
fQuery(selector: String): fQuery
fQuery(blob: Blob): fQuery
fQuery(selector1: String, selector2: String, blob1: Blob, ...): fQuery
fQuery( [ selector1: String, selector2: String, blob1: Blob, ... ] ): fQuery
// select a specific file
fQuery('a.txt')
fQuery('folder/b.js')
fQuery('/home/user/README.txt')
// select with globstar notation
fQuery('src/css/*.less')
fQuery('src/js/**/*.js')
// multiple selections are separated by ','
fQuery('folder/*.txt, assets/**/*')
// a group of multiple selections may share a common prefix separated by a ':'
fQuery('folder/src: *.js, *.html')
// multiple groups are separated by ';'
fQuery('folder/src: *.js, *.html; other/project: *.html, *.js, **/*.txt')
fQuery.plugin()
// register a plugin
fQuery.plugin(module: String)
fQuery.plugin(fn(fQuery): Function)