本文整理汇总了TypeScript中vs/base/node/stream.readExactlyByFile函数的典型用法代码示例。如果您正苦于以下问题:TypeScript readExactlyByFile函数的具体用法?TypeScript readExactlyByFile怎么用?TypeScript readExactlyByFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readExactlyByFile函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('detectEncodingFromBuffer (JSON saved as PNG)', async function () {
const file = getPathFromAmdModule(require, './fixtures/some.json.png');
const buffer = await readExactlyByFile(file, 512);
const mimes = encoding.detectEncodingFromBuffer(buffer);
assert.equal(mimes.seemsBinary, false);
});
示例2: test
test('detectEncodingFromBuffer (QWOFF saved as TXT)', function () {
const file = require.toUrl('./fixtures/some.qwoff.txt');
return readExactlyByFile(file, 512).then(buffer => {
const mimes = encoding.detectEncodingFromBuffer(buffer);
assert.equal(mimes.seemsBinary, true);
});
});
示例3: test
test('detectEncodingFromBuffer (CSS saved as QWOFF)', function () {
const file = getPathFromAmdModule(require, './fixtures/some.css.qwoff');
return readExactlyByFile(file, 512).then(buffer => {
const mimes = encoding.detectEncodingFromBuffer(buffer);
assert.equal(mimes.seemsBinary, false);
});
});
示例4: test
test('readExactlyByFile - empty', function () {
const file = getPathFromAmdModule(require, './fixtures/empty.txt');
return stream.readExactlyByFile(file, 10).then(({ bytesRead }) => {
assert.equal(bytesRead, 0);
});
});
示例5: test
test('readExactlyByFile - empty', function () {
const file = require.toUrl('./fixtures/empty.txt');
return stream.readExactlyByFile(file, 10).then(({ bytesRead }) => {
assert.equal(bytesRead, 0);
});
});
示例6: test
test('detectMimesFromFile (PDF)', function () {
const file = require.toUrl('./fixtures/some.pdf');
return readExactlyByFile(file, 512).then(buffer => {
const mimes = mime.detectMimeAndEncodingFromBuffer(buffer);
assert.deepEqual(mimes.mimes, ['application/octet-stream']);
});
});