
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
nest-csv-parser
Advanced tools
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Nest framework TypeScript starter repository.
Wrapper for csv-parser library
$ npm install nest-csv-parser
# or if you using Yarn
$ yarn add nest-csv-parser
Add nest-csv-parser as a dependency.
import { Module } from '@nestjs/common'
import { CsvModule } from 'nest-csv-parser'
// ...imports of your app dependecies
@Module({
imports: [
CsvModule, // <-- add into imports
...
],
controllers: [ ... ],
providers: [ ... ]
})
export class AppModule {}
Parser will create instance of entity for each line in CSV stream.
// app.parser.ts
import { Injectable } from '@nestjs/common'
import { CsvParser } from 'nest-csv-parser'
class Entity {
foo: string
bar: string
}
@Injectable()
export class AppService {
constructor(
private readonly csvParser: CsvParser
) {}
async parse() {
// Create stream from file (or get it from S3)
const stream = fs.createReadStream(__dirname + '/some.csv')
const entities: Entity[] = await csvParser.parse(stream, Entity)
return entities
}
}
csvParser.parse(stream, Entity, count, offset, csvConfig)
has 5 parameters.
required
First parameter has to be the stream of the CSV file. NodeJS Reference
required
Has to be object from which will parser create instance.
default: null
How many lines you want to parse.
default: null
Offset is similar to SQL databases. Skips the N lines from the beginning of the file.
default
{ strict: true, separator: ';' }
Just a configuration object for csv-parser library options you can find here
# clone repository
$ git clone git@github.com:mCzolko/nest-csv-parser.git
$ cd nest-csv-parser
# install dependencies
$ yarn install
# watch mode
$ yarn test:watch
# unit tests
$ yarn test
Michael Czolko
FAQs
CSV parser for NestJS framework
The npm package nest-csv-parser receives a total of 7,779 weekly downloads. As such, nest-csv-parser popularity was classified as popular.
We found that nest-csv-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.