🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

csv2file

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv2file

CSV templating to file

latest
Source
npmnpm
Version
1.0.7
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

csv2file

CSV convert to file with mustache.js template engine

example

Input

name,lon,lat
site1,37.35283315785131,127.10973623874524
site2,37.54505211168097,126.96725290258685
site3,37.65628827419806, 127.25682722308225

template

insert into map_source.tbl_map_source_layer_fragment
  (geometry, map_source_layer_id, id, "name")
values (ST_Transform(ST_GeomFromText('POINT({{lon}} {{lat}})', 4326), 3857), 6, '', '{{name}}');

Output

insert into map_source.tbl_map_source_layer_fragment
  (geometry, map_source_layer_id, id, "name")
values (ST_Transform(ST_GeomFromText('POINT(127.10973623874524 37.35283315785131)', 4326), 3857), 6, '', 'site1');

Installation

# global use
npm install -g csv2file

# module import
npm install csv2file

Usage

shell script

csv2file -i ./sample/sample.csv -t ./sample/sample.tmpl.sql

nodejs

const csv2file = require('csv2file');

// return Promise
csv2file({
  input: './example.csv',
  template: './template.sql',
  output: './example.sql',
}, {
  unique: 'ID'
});

License

MIT LICENSE.md

Keywords

csv

FAQs

Package last updated on 09 Nov 2021

Did you know?

Socket

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.

Install

Related posts