data-forge-fs
Advanced tools
Comparing version 0.0.7 to 0.0.8
import { IDataFrame, ICSVOptions } from 'data-forge'; | ||
import { ICSVOutputOptions } from 'data-forge/build/lib/dataframe'; | ||
/** | ||
@@ -180,2 +181,4 @@ * Packages a dataframe ready for serialization to a CSV format text file. | ||
* | ||
* @param [options] Optional configuration for CSV output. | ||
* | ||
* @return Returns a {@link ICsvSerializer} that represents the dataframe for serialization in the CSV format. Call `writeFile` or `writeFileSync` to output the CSV data to a text file. | ||
@@ -195,3 +198,3 @@ * | ||
*/ | ||
export declare function asCSV<IndexT, ValueT>(this: IDataFrame<IndexT, ValueT>): ICsvSerializer; | ||
export declare function asCSV<IndexT, ValueT>(this: IDataFrame<IndexT, ValueT>, options?: ICSVOutputOptions): ICsvSerializer; | ||
/** | ||
@@ -198,0 +201,0 @@ * Treat the dataframe as JSON data for purposes of serialization. |
@@ -46,4 +46,5 @@ "use strict"; | ||
var CsvSerializer = /** @class */ (function () { | ||
function CsvSerializer(dataframe) { | ||
function CsvSerializer(dataframe, options) { | ||
this.dataframe = dataframe; | ||
this.options = options; | ||
} | ||
@@ -70,3 +71,3 @@ /** | ||
var fs = require('fs'); | ||
fs.writeFile(filePath, _this.dataframe.toCSV(), function (err) { | ||
fs.writeFile(filePath, _this.dataframe.toCSV(_this.options), function (err) { | ||
if (err) { | ||
@@ -95,3 +96,3 @@ reject(err); | ||
var fs = require('fs'); | ||
fs.writeFileSync(filePath, this.dataframe.toCSV()); | ||
fs.writeFileSync(filePath, this.dataframe.toCSV(this.options)); | ||
}; | ||
@@ -160,2 +161,4 @@ return CsvSerializer; | ||
* | ||
* @param [options] Optional configuration for CSV output. | ||
* | ||
* @return Returns a {@link ICsvSerializer} that represents the dataframe for serialization in the CSV format. Call `writeFile` or `writeFileSync` to output the CSV data to a text file. | ||
@@ -175,4 +178,4 @@ * | ||
*/ | ||
function asCSV() { | ||
return new CsvSerializer(this); | ||
function asCSV(options) { | ||
return new CsvSerializer(this, options); | ||
} | ||
@@ -179,0 +182,0 @@ exports.asCSV = asCSV; |
{ | ||
"name": "data-forge-fs", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "This library contains the file system extensions to Data-Forge that allow it to directly read and write CSV and JSON files in Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
36541
841