本文整理汇总了TypeScript中csv-stringify.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript csv-stringify.default方法的具体用法?TypeScript csv-stringify.default怎么用?TypeScript csv-stringify.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类csv-stringify
的用法示例。
在下文中一共展示了csv-stringify.default方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createWriteStream
static createWriteStream(dest: string, opts: WriteOptions = {}): CSVWriteStream {
if (!opts.delimiter) opts.delimiter = this.getDefaultDelimiter(dest);
const stringifyOptions = this.getStringifyOptions(opts);
const stringifyTransform = stringify(stringifyOptions);
stringifyTransform.pipe(createWriteStream(dest));
return stringifyTransform;
}
示例2: csvStringify
return new Promise<string>((resolve, reject) => {
csvStringify(rows, (error, output) => {
if (error) {
reject(error);
} else {
resolve(output);
}
});
});
示例3: write
static write(dest: string, data: any[], arg1: any, arg2?: any): void {
const writeOptions = arg2 ? arg1 : {};
const cb = arg2 ? arg2 : arg1;
if (!writeOptions.delimiter) writeOptions.delimiter = this.getDefaultDelimiter(dest);
const stringifyOptions = this.getStringifyOptions(writeOptions, data);
const nestedArrayData = this.getNestedArrayData(data, stringifyOptions.columns);
stringify(nestedArrayData, stringifyOptions, (err, stringData) => {
if (err) { return cb(err); }
writeFile(dest, stringData, cb);
});
}
示例4: csvStringify
services.history.onNewRecord.subscribe(record => csvStringify(
[Object.values(record)],
(_error, output) => appendFileSync(historyFilePath, output),
));
示例5: stringify
static stringify(data: any[], opts: WriteOptions, cb: ResultCb<string>) {
if (!opts.delimiter) opts.delimiter = ',';
const stringifyOptions = this.getStringifyOptions(opts, data);
const nestedArrayData = this.getNestedArrayData(data, stringifyOptions.columns);
stringify(nestedArrayData, stringifyOptions, cb);
}