The get method returns a Stream. For example, to save the path data to a specified destination:
var data = hexo.route.get('index.html'); var dest = fs.createWriteStream('somewhere');
data.pipe(dest);
Set a Path
The set method takes a string, a Buffer or a function.
// String hexo.route.set('index.html', 'index')
// Buffer hexo.route.set('index.html', new Buffer('index'));
// Function (Promise) hexo.route.set('index.html', function(){ returnnewPromise(function(resolve, reject){ resolve('index'); }); });
// Function (Callback) hexo.route.set('index.html', function(callback){ callback(null, 'index'); });
You can also set a boolean for whether a path has been modified or not. This can speed up file generation as it allows for ignoring the unmodified files.