本文整理汇总了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)