本文整理汇总了TypeScript中sha.js类的典型用法代码示例。如果您正苦于以下问题:TypeScript js类的具体用法?TypeScript js怎么用?TypeScript js使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了js类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('adds some files to repo', () => {
fse.outputFileSync('a.txt', 'a test file\nnew line in a.txt\n\n');
fse.outputFileSync('b.txt', '\nb test file\nnew line in b.txt\n\nYep');
aHash = createHash('sha256').update(fs.readFileSync('a.txt')).digest('hex');
aTime = fs.statSync('a.txt').mtime.getTime();
bHash = createHash('sha256').update(fs.readFileSync('b.txt')).digest('hex');
bTime = fs.statSync('b.txt').mtime.getTime();
let res = Client.status(repo);
assert.deepEqual(res.added.sort(), ['a.txt', 'b.txt']);
assert.deepEqual(res.addedStaged, []);
assert.deepEqual(res.modified, []);
assert.deepEqual(res.modifiedStaged, []);
assert.deepEqual(res.removed, []);
assert.deepEqual(res.removedStaged, []);
assert.deepEqual(res.allAdded.sort(), ['a.txt', 'b.txt']);
assert.deepEqual(res.allModified, []);
assert.deepEqual(res.allRemoved, []);
assert.deepEqual(res.allNewChanges.sort(), ['a.txt', 'b.txt']);
assert.deepEqual(res.allStagedChanges, []);
assert.deepEqual(res.allChanges.sort(), ['a.txt', 'b.txt']);
});
示例2: it
it(".resolveObjectByContents", () => {
var fs = FS.fs();
var bf1 = new Buffer("Hello");
var firstFileObject = fs.create(bf1);
var firstHash = createHash('sha256').update(bf1).digest('hex');
nfs.writeFile(path.join('.jerk', 'objects', firstHash), bf1);
assert.deepEqual(fs.resolveObjectByContents(bf1), firstFileObject);
/*var bf2 = new Buffer("World");
var secondFileObject = fs.create(bf2);
var secondHash = createHash('sha256').update(bf2).digest('hex');
nfs.writeFile(path.join('.jerk', secondHash, bf2, 0o644);
assert.deepEqual(nfs.readFile(path.join('.jerk', secondHash, 'utf8'), fs.resolveObjectByContents(bf2));*/
});
示例3: it
it(".hash", () => {
var bf1 = new Buffer("Hello");
var fileObject = fs.create(bf1);
var hash = createHash('sha256').update(bf1).digest('hex');
assert.deepEqual(hash, fileObject.hash());
});