jsforce
    Preparing search index...

    Class Bulk<S>

    Class for Bulk API

    Type Parameters

    Index
    _logger: Logger
    pollInterval: number = 1000

    Polling interval in milliseconds

    Default: 1000 (1 second)

    pollTimeout: number = 30000

    Polling timeout in milliseconds

    Default: 30000 (30 seconds)

    • Create and start bulkload job and batch

      This method will return a Batch instance (writable stream) which you can write records into as a CSV string.

      Batch also implements the a promise interface so you can await this method to get the job results.

      Type Parameters

      Parameters

      • type: string
      • operation: Opr
      • Optionalinput: string | Readable | Record[]

      Returns Batch<S, Opr>

      // Insert an array of records and get the job results

      const res = await connection.bulk.load('Account', 'insert', accounts)
      // Insert records from a csv file using the returned batch stream

      const csvFile = fs.createReadStream('accounts.csv')

      const batch = conn.bulk.load('Account', 'insert')

      // The `response` event is emitted when the job results are retrieved
      batch.on('response', res => {
      console.log(res)
      })

      csvFile.pipe(batch.stream())
    • Create and start bulkload job and batch

      This method will return a Batch instance (writable stream) which you can write records into as a CSV string.

      Batch also implements the a promise interface so you can await this method to get the job results.

      Type Parameters

      Parameters

      • type: string
      • operation: Opr
      • OptionaloptionsOrInput: string | Readable | Record[] | BulkOptions
      • Optionalinput: string | Readable | Record[]

      Returns Batch<S, Opr>

      // Insert an array of records and get the job results

      const res = await connection.bulk.load('Account', 'insert', accounts)
      // Insert records from a csv file using the returned batch stream

      const csvFile = fs.createReadStream('accounts.csv')

      const batch = conn.bulk.load('Account', 'insert')

      // The `response` event is emitted when the job results are retrieved
      batch.on('response', res => {
      console.log(res)
      })

      csvFile.pipe(batch.stream())