本文整理匯總了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());
});