How to use the hexo-util.hash function in hexo-util

To help you get started, we’ve selected a few hexo-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexojs / hexo / test / scripts / box / box.js View on Github external
it('process() - update (mtime changed and hash changed)', () => {
    const box = newBox('test');
    const name = 'a.txt';
    const path = pathFn.join(box.base, name);
    const cacheId = 'test/' + name;

    const processor = sinon.spy();
    box.addProcessor(processor);

    return Promise.all([
      fs.writeFile(path, 'a'),
      box.Cache.insert({
        _id: cacheId,
        modified: 0,
        hash: util.hash('b').toString('hex')
      })
    ]).then(() => box.process()).then(() => {
      const file = processor.args[0][0];
      file.type.should.eql('update');
      file.path.should.eql(name);
    }).finally(() => fs.rmdir(box.base));
  });
github hexojs / hexo / test / scripts / box / box.js View on Github external
return fs.writeFile(path, 'a').then(() => fs.stat(path)).then(stats => box.Cache.insert({
      _id: cacheId,
      modified: 0,
      hash: util.hash('a').toString('hex')
    })).then(() => box.process()).then(() => {
      const file = processor.args[0][0];