本文整理匯總了TypeScript中@es-git/core.concat函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript concat函數的具體用法?TypeScript concat怎麽用?TypeScript concat使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了concat函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: asyncIteratorToBuffer
export default async function asyncIteratorToBuffer(iterator : AsyncIterableIterator<Uint8Array>){
const body = [];
for await(const chunk of iterator){
body.push(chunk);
}
return concat(...body).buffer as ArrayBuffer
}
示例2: consume
async function consume(stream : AsyncIterableIterator<Uint8Array>){
const result : Uint8Array[] = [];
for await(const chunk of stream){
result.push(chunk);
}
return concat(...result);
}
示例3: encodeTree
export function encodeTree(body : TreeBody) {
return concat(...flatten(Object.keys(body)
.map(key => ({
name: key,
...body[key]
}))
.sort(treeSort)
.map(entry => [encode(`${entry.mode.toString(8)} ${entry.name}\0`), packHash(entry.hash)])));
}
示例4: encodeRaw
export function encodeRaw(type : string, bytes : Uint8Array){
return concat(encode(`${type} ${bytes.length}\0`), bytes);
}
示例5: encodeObject
export default function encodeObject(object : GitObject) : Uint8Array {
const bytes = getBytes(object);
return concat(encode(`${object.type} ${bytes.length}\0`), bytes);
}