本文整理匯總了TypeScript中jcrypt.stream函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript stream函數的具體用法?TypeScript stream怎麽用?TypeScript stream使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了stream函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: logSuccess
.then(list =>
jcrypt.stream(JSON.stringify(list, null, 4), keyFile, {
gpg: libUtil.getGPGArgs(),
file: {
flags: 'w',
defaultEncoding: 'utf8',
fd: null,
mode: 0o0600
}
}, true)
.then(():void => logSuccess('Key has been removed'))
.catch(logError)
示例2: logSuccess
.catch((): string =>
jcrypt.stream(key, `${keyDir}/${hashedFilename}`, {
gpg: util.getGPGArgs(),
file: {
flags: 'w',
defaultEncoding: 'utf8',
fd: null,
mode: 0o0600
}
}, true)
.then(() => logSuccess('File created successfully'))
.catch(logError)
示例3: logSuccess
.then((file: string): string => {
logSuccess(`Created encrypted config file ${file}`);
// Create entry list file.
return jcrypt.stream(JSON.stringify({}, null, 4), `${stymieDir}/k`, {
gpg: arr,
file: {
flags: 'w',
defaultEncoding: 'utf8',
fd: null,
mode: 0o0600
}
}, true);
})
示例4:
.then((data: string): string => {
const list = JSON.parse(data);
const item = list[entry.key] = {};
// TODO: Iterator.
for (let n in entry) {
if (entry.hasOwnProperty(n) && n !== 'key') {
item[n] = entry[n];
}
}
return jcrypt.stream(JSON.stringify(list, null, 4), keyFile, {
gpg: util.getGPGArgs(),
file: {
flags: 'w',
defaultEncoding: 'utf8',
fd: null,
mode: 0o0600
}
}, true);
})
示例5:
.then((file: string): string =>
// Pipe to stdout.
jcrypt.stream(file, null, ['--decrypt'])
.catch(logError)