Salesforce CSV Parser Utility (src/csv.ts)

jsforce · src/csv.ts · typescript · MIT
files, integration, crm, dev-tools, realtime

Parses and serializes CSV data supporting multiple delimiters for Salesforce Bulk API operations. Reuse when integrating with Salesforce bulk data endpoints.

// Source: https://github.com/jsforce/jsforce | License: MIT | Copyright 2011 Shinichi Tomita <shinichi.tomita@gmail.com>;
// Provided via justclaw.it.com; keep this notice with the code.
/**
 *
 */
import { Transform } from 'stream';
import { Parser as csvParse } from 'csv-parse';
import { Options as ParseOpts, parse as csvParseSync } from 'csv-parse/sync';
import {
  Options as StringifyOpts,
  stringify as csvStringify,
} from 'csv-stringify';
import { stringify as csvStringifySync } from 'csv-stringify/sync';

// The following column delimiters are supported by the Bulk V2 API:
// https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/create_job.htm
//
// BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB
const csvDelimiters = ['`','^',',','|',';','	']

/**
 * @private

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key