xlsx-write-stream
Advanced tools
Comparing version 0.0.23 to 1.0.0-beta.0
'use strict'; | ||
module.exports = require('./XLSXWriteStream.js').default; | ||
module.exports = require('./XLSXTransformStream').default; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
const unixTimestamp = value.getTime(); | ||
const officeTimestamp = unixTimestamp / 86400000 + 25569; | ||
const officeTimestamp = unixTimestamp / MILLISECONDS_IN_ONE_DAY + OFFSET_DAYS; | ||
const maybeFormat = shouldFormat && (0, _utils.getDateFormat)(); | ||
@@ -29,2 +29,8 @@ return `<c r="${cell}" t="n"${maybeFormat ? ` s="${maybeFormat}"` : ''}><v>${officeTimestamp}</v></c>`; | ||
var _utils = require('../utils'); | ||
var _utils = require('../utils'); | ||
// 25569 = Days between 1970/01/01 and 1900/01/01 (min date in Windows Excel) | ||
const OFFSET_DAYS = 25569; | ||
// 24 * 60 * 60 * 1000 | ||
const MILLISECONDS_IN_ONE_DAY = 86400000; |
@@ -7,2 +7,11 @@ 'use strict'; | ||
var _cell = require('./cell'); | ||
Object.defineProperty(exports, 'Cell', { | ||
enumerable: true, | ||
get: function () { | ||
return _interopRequireDefault(_cell).default; | ||
} | ||
}); | ||
var _row = require('./row'); | ||
@@ -9,0 +18,0 @@ |
@@ -17,5 +17,5 @@ 'use strict'; | ||
do { | ||
position = remaining % 26; | ||
position = remaining % baseString.length; | ||
cellXPosition = baseString[position] + cellXPosition; | ||
remaining = Math.floor(remaining / 26) - 1; | ||
remaining = Math.floor(remaining / baseString.length) - 1; | ||
} while (remaining >= 0); | ||
@@ -22,0 +22,0 @@ return `${cellXPosition}${rowIndex + 1}`; |
126
package.json
{ | ||
"name": "xlsx-write-stream", | ||
"version": "0.0.23", | ||
"description": "XLSX stream writer", | ||
"main": "dist/index.js", | ||
"keywords": [ | ||
"apify", | ||
"apifier", | ||
"xslx", | ||
"stream" | ||
], | ||
"author": { | ||
"name": "Apify", | ||
"email": "support@apify.com", | ||
"url": "https://www.apify.com" | ||
}, | ||
"contributors": [ | ||
"Jaroslav Hejlek <jaroslav@apify.com>" | ||
], | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/apifytech/xlsx-stream" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/apifytech/xlsx-stream" | ||
}, | ||
"homepage": "https://github.com/apifytech/xlsx-stream", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"start": "npm run build && node dist/index.js", | ||
"build": "npm run clean && babel src --out-dir dist", | ||
"test": "npm run build && mocha --compilers js:babel-core/register --recursive", | ||
"test-cov": "npm run build && babel-node node_modules/isparta/bin/isparta cover --report html --report text node_modules/.bin/_mocha", | ||
"prepare": "npm run build", | ||
"clean": "rm -rf dist", | ||
"lint": "eslint src test", | ||
"prepublishOnly": "(test $RUNNING_FROM_SCRIPT || (echo \"You must use publish.sh instead of 'npm publish' directly!\"; exit 1)) && npm test && npm run lint" | ||
}, | ||
"dependencies": { | ||
"archiver": "^2.1.0", | ||
"lodash": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
"apify-jsdoc-template": "github:apifytech/apify-jsdoc-template", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.0.1", | ||
"babel-preset-node8": "^1.2.0", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.9.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jsx-a11y": "6.0.2", | ||
"eslint-plugin-mocha": "^4.11.0", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-react": "7.4.0", | ||
"isparta": "^4.0.0", | ||
"mocha": "^4.0.1", | ||
"sinon": "^4.0.1", | ||
"sinon-stub-promise": "^4.0.0" | ||
} | ||
"name": "xlsx-write-stream", | ||
"version": "1.0.0-beta.0", | ||
"description": "XLSX stream writer", | ||
"main": "dist/index.js", | ||
"keywords": [ | ||
"apify", | ||
"apifier", | ||
"xlsx", | ||
"stream" | ||
], | ||
"author": { | ||
"name": "Apify", | ||
"email": "support@apify.com", | ||
"url": "https://www.apify.com" | ||
}, | ||
"contributors": [ | ||
"Jaroslav Hejlek <jaroslav@apify.com>" | ||
], | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/apify/xlsx-stream" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/apify/xlsx-stream" | ||
}, | ||
"homepage": "https://github.com/apify/xlsx-stream", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"start": "npm run build && node dist/index.js", | ||
"build": "npm run clean && babel src --out-dir dist", | ||
"test": "npm run build && mocha --require babel-core/register --recursive", | ||
"test-cov": "npm run build && babel-node node_modules/isparta/bin/isparta cover --report html --report text node_modules/.bin/_mocha", | ||
"prepare": "npm run build", | ||
"clean": "rm -rf dist", | ||
"lint": "eslint src test" | ||
}, | ||
"dependencies": { | ||
"archiver": "^5.3.0", | ||
"lodash": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
"apify-jsdoc-template": "github:apify/apify-jsdoc-template", | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.0.1", | ||
"babel-preset-node8": "^1.2.0", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.9.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jsx-a11y": "6.0.2", | ||
"eslint-plugin-mocha": "^4.11.0", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-react": "7.4.0", | ||
"isparta": "^4.0.0", | ||
"mocha": "^8.3.2", | ||
"sinon": "^4.0.1", | ||
"sinon-stub-promise": "^4.0.0", | ||
"unzipper": "^0.10.11" | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
# XLSX Write Stream [![Build Status](https://travis-ci.org/apifytech/xlsx-stream.svg)](https://travis-ci.org/apifytech/xlsx-stream) [![npm version](https://badge.fury.io/js/xlsx-write-stream.svg)](http://badge.fury.io/js/xlsx-write-stream) | ||
# XLSX Write Stream library | ||
[![Build Status](https://travis-ci.org/apify/xlsx-stream.svg?branch=master)](https://travis-ci.org/apify/xlsx-stream) [![npm version](https://badge.fury.io/js/xlsx-write-stream.svg)](http://badge.fury.io/js/xlsx-write-stream) | ||
XLSX Write Stream is a streaming writer for XLSX spreadsheets. Its purpose is to replace CSV for large exports, because using | ||
@@ -19,18 +21,9 @@ CSV in Excel is very buggy and error prone. It's very efficient and can quickly write hundreds of thousands of rows with | ||
```node | ||
import XLSXWriteStream from 'xlsx-write-stream'; | ||
import XLSXTransformStream from 'xlsx-write-stream'; | ||
// Initialize the writer | ||
const xlsxWriter = new XLSXWriteStream(); | ||
// Set input stream. Input stream needs to implement Stream.Readable interface | ||
// Input stream needs to implement Stream.Readable interface | ||
// and each chunk should be an array of values (only string, date and number are supported value types) | ||
xlsxWriter.setInputStream(inputStream); | ||
// Get output stream. This will return a stream of XLSX file data. | ||
const xlsxStream = xlsxWriter.getOutputStream(); | ||
// do something with the output, like write it into file or send it as HTTP response | ||
const writeStream = fs.createWriteStream('file.xlsx'); | ||
xlsxStream.pipe(writeStream); | ||
inputStream | ||
.pipe(new XLSXTransformStream()) // This stream transforms the input into a xlsx format | ||
.pipe(fs.createWriteStream('file.xlsx')); // We need to store the result somewhere | ||
``` | ||
@@ -37,0 +30,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29902
18
387
18
33
1
+ Addedarchiver@5.3.2(transitive)
+ Addedarchiver-utils@2.1.03.0.4(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcompress-commons@4.1.2(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addedcrc32-stream@4.0.3(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.difference@4.5.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.isplainobject@4.0.6(transitive)
+ Addedlodash.union@4.6.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedreaddir-glob@1.1.3(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedzip-stream@4.1.1(transitive)
- Removedarchiver@2.1.1(transitive)
- Removedarchiver-utils@1.3.0(transitive)
- Removedasync@2.6.4(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcompress-commons@1.2.2(transitive)
- Removedcrc@3.8.0(transitive)
- Removedcrc32-stream@2.0.0(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)
- Removedzip-stream@1.2.0(transitive)
Updatedarchiver@^5.3.0