@aternus/csv-to-xlsx
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -16,2 +16,13 @@ # Changelog | ||
## [1.0.2] - 2018-09-18 | ||
### Added | ||
- Added sections to README.md. | ||
### Changed | ||
- Updated the package description. | ||
- Updated the publish script. | ||
### Fixed | ||
- NPM bin. | ||
## [1.0.1] - 2018-09-17 | ||
@@ -18,0 +29,0 @@ ### Changed |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict";const path=require("path");const fs=require("fs-extra");const program=require("commander");const convertCsvToXlsx=require("./convertCsvToXlsx");if(module.parent){module.exports=convertCsvToXlsx}else{const pkg=require("../package");program.version(pkg.version,"-v, --version").option("-i, --input-dir [dir]","Input directory that has the CSV files","csv").option("-o, --output-dir [dir]","Output directory for the XLSX files","xlsx");program.on("--help",function(){console.log(``);console.log(`Created by: ${pkg.author}`);console.log(`Please report bugs at: ${pkg.bugs.url}`)});program.parse(process.argv);const csvPath=path.join(process.cwd(),program.inputDir);const xlsxPath=path.join(process.cwd(),program.outputDir);if(!fs.existsSync(csvPath)){console.error(`Invalid input directory: ${csvPath}\n`);process.exitCode=1;program.help()}if(!fs.existsSync(xlsxPath)){console.info(`Creating output directory: ${xlsxPath}`);fs.mkdirpSync(xlsxPath)}const csvFiles=fs.readdirSync(csvPath);for(let file of csvFiles){const fileObject=path.parse(file);if(fileObject.ext!==".csv"){continue}console.info(`Converting: ${fileObject.name}`);try{convertCsvToXlsx(path.join(csvPath,file),path.join(xlsxPath,`${fileObject.name}.xlsx`))}catch(e){console.info(`${e.toString()}`)}}console.log(`Complete.`)} |
{ | ||
"name": "@aternus/csv-to-xlsx", | ||
"version": "1.0.1", | ||
"description": "Node.js command-line tool and a library to convert CSV files to XLSX (Excel 2007+ XML Format) files.", | ||
"version": "1.0.2", | ||
"description": "Command-line tool and a Node.js library to convert CSV files to XLSX (Excel 2007+ XML Format) files.", | ||
"keywords": [ | ||
@@ -13,10 +13,11 @@ "convert", | ||
"multilingual", | ||
"batch" | ||
"batch", | ||
"cli", | ||
"windows", | ||
"linux", | ||
"macos" | ||
], | ||
"main": "dist/csv-to-xlsx.js", | ||
"bin": { | ||
"csv-to-xlsx": "dist/csv-to-xlsx.js", | ||
"csv-to-xlsx-win": "bin/csv-to-xlsx-win.exe", | ||
"csv-to-xlsx-linux": "bin/csv-to-xlsx-linux", | ||
"csv-to-xlsx-macos": "bin/csv-to-xlsx-macos" | ||
"csv-to-xlsx": "dist/csv-to-xlsx.js" | ||
}, | ||
@@ -23,0 +24,0 @@ "scripts": { |
# @aternus/csv-to-xlsx | ||
Convert CSV files to XLSX (Excel 2007+ XML Format). | ||
Command-line tool to convert CSV files to XLSX (Excel 2007+ XML Format) files written in JavaScript. | ||
Precompiled binaries (see the `bin` folder) are available for: | ||
- Windows x64 | ||
- Linux x64 | ||
- MacOS | ||
## Installation | ||
@@ -15,35 +20,35 @@ | ||
### CLI | ||
### Precompiled Binary (Command-line) | ||
@TODO | ||
```bash | ||
./csv-to-xlsx-linux -i "input-directory" -o "output-directory" | ||
``` | ||
### Node.js | ||
### Node.js CLI | ||
@TODO | ||
Type `--help` for a full list of options. | ||
```javascript | ||
```bash | ||
npx csv-to-xlsx -i "input-directory" -o "output-directory" | ||
``` | ||
### Node.js | ||
## Example | ||
```javascript | ||
const path = require('path'); | ||
const convertCsvToXlsx = require('@aternus/csv-to-xlsx'); | ||
@TODO | ||
let source = path.join(__dirname, 'SalesJan2009.csv'); | ||
let destination = path.join(__dirname, 'converted_report.xlsx'); | ||
try { | ||
convertCsvToXlsx(source, destination); | ||
} catch (e) { | ||
console.error(e.toString()); | ||
} | ||
``` | ||
## FAQ | ||
## Options | ||
## Credits | ||
## License | ||
Released under the MIT License - see `LICENSE.md` for details. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
132149794
1
54