1.1.1 • Published 7 years ago
@kevinrambaud/csv-to-sitemap v1.1.1
csv-to-sitemap
Simple node.js package allowing to convert a csv content to a sitemap.xml content.
Installation
Make sure you have node installed with npm.
$ npm i @kevinrambaud/csv-to-sitemap --save
or if you use yarn package manager
$ yarn add @kevinrambaud/csv-to-sitemap
Usage
Based on the fact that you have a file intitled myfile.csv next to your js file.
myfile.csv
loc;lastmod
http://kevinrambaud.com;2017-08-01
http://kevinrambaud.com/hi;2017-08-01
index.js
// Import module
const { promisify } = require('util');
const { readFile } = require('fs');
const { convertToXml } = require('@kevinrambaud/csv-to-sitemap');
// Transform in promise the readFile function
const readFileAsync = promisify(readFile);
// Convert the csv file
readFileAsync('./myfile.csv', 'utf8')
.then(csvContent => convertToXml(csvContent))
.then(xmlContent => console.log(xmlContent))
.catch(err => console.error(err));
Contributing
- Fork it
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Credits
All awesome developers that created each pieces used into this project.
Authors
- Kevin Rambaud - Initial work - website
See also the list of contributors who participated in this project.
License
MIT