How to use the node-xlsx.default function in node-xlsx

To help you get started, we’ve selected a few node-xlsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fndroid / clash_speedtest / index.js View on Github external
const speedTest = require('speedtest-net');
// const speedTest = require('./speedtest/index')
require('draftlog').into(console)
const axios = require('axios')
const node_xlsx = require('node-xlsx')
const fs = require('fs')
const path = require('path')
const moment = require('moment')

const EC = "127.0.0.1:9090" // 外部控制器 External Controller
const TIME = 10 // 测试时间,单位秒
const PROXY = "http://127.0.0.1:7890" // Clash的http代理

let xlsx = node_xlsx.default

let startTesting = async (id) => {
  return new Promise((resolve, reject) => {
    var test = speedTest({ maxTime: TIME * 1000, serverId: id, proxy: PROXY });

    // test.on('data', data => {
    //   // console.log('data:', data)
    //   resolve(data)
    // });

    let tid = setTimeout(() => {
      resolve({ speeds: { download: '-', upload: '-' }, server: { ping: '-', country: '-' } });
    }, (10 + TIME) * 1000 );

    test.on('downloadspeed', speed => {
      clearTimeout(tid)
github wztscau / vue-i18n-xlsx / lib / output.js View on Github external
const Excel = require('node-xlsx').default
const fs = require('fs')
const path = require('path')
const mkdirsSync = require('./utils').mkdirsSync
const chalk = require('chalk')
const Log = console.log
const Warn = console.warn
const Error = console.error

module.exports = function (excelPath, jsPath, projectPath) {
  ///////// START /////////
  let startTime = Date.now()
  // File path must end with .xlsx
  excelPath = excelPath.endsWith('.xlsx') ? excelPath : excelPath + '.xlsx'
  // Read from excel
  let inputData = []
  try {
github wztscau / vue-i18n-xlsx / lib / input.js View on Github external
const Excel = require('node-xlsx').default
const fs = require('fs')
const path = require('path')
const os = require('os')
const mergeSort = require('./utils').mergeSort
const mkdirsSync = require('./utils').mkdirsSync
const chalk = require('chalk')
const Log = console.log
const Warn = console.warn
const Error = console.error

/**
 * traversingDirectory
 * @param {string} rootPath 
 * @param {function} fileCb 
 * @returns {array} files
 */
github zapkub / cu-vivid-museum-wiki / server / updates / 0.0.6-garden.js View on Github external
const XLSX = require('node-xlsx').default;
const path = require('path');
const keystone = require('keystone');
const _ = require('lodash');

const Plant = keystone.list('Plant');
const PlantCategory = keystone.list('Category');
const Location = keystone.list('Location');

const gardenSheet = XLSX.parse(path.join(__dirname, '../../seed/Garden.xls'));


function letterToColumns(input) {
  return input.charCodeAt(0) - 65;
}

const gardens = gardenSheet[0]
github etalab / decoupage-administratif / build / util.js View on Github external
const {join} = require('path')
const {promisify} = require('util')
const zlib = require('zlib')
const getStream = require('get-stream').array
const parse = require('csv-parser')
const decompress = require('decompress')
const {decodeStream} = require('iconv-lite')
const pumpify = require('pumpify').obj
const {outputFile} = require('fs-extra')
const intoStream = require('into-stream')
const {readFile} = require('fs-extra')
const xlsx = require('node-xlsx').default

const gunzip = promisify(zlib.gunzip)

function getSourceFilePath(fileName) {
  return join(__dirname, '..', 'sources', fileName)
}

async function extractDataFromFile(path) {
  const [file] = await decompress(path)
  const stream = pumpify(
    intoStream(file.data),
    decodeStream('win1252'),
    parse({separator: '\t', strict: true})
  )
  return getStream(stream)
}
github zapkub / cu-vivid-museum-wiki / seed / index.js View on Github external
const XLSX = require('node-xlsx').default;
const path = require('path');
const _ = require('lodash');
const fs = require('fs');
const ObjectID = require('mongodb').ObjectID;
const gardenSheet = XLSX.parse(path.join(__dirname, './garden.xlsx'));
const herbariumnSheet = XLSX.parse(path.join(__dirname, './herbarium.xlsx'));

let amount = process.env.JSON_PARSE_AMOUNT || 999999999;

exports.setAmount = function setAmount(_amount) {
    amount = _amount;
}
function encodeRFC5987ValueChars(str) {
    return encodeURI(str).
        replace(/['()]/g, escape)
}
github zapkub / cu-vivid-museum-wiki / server / updates / 0.0.5-herbarium.js View on Github external
const XLSX = require('node-xlsx').default;
const path = require('path');
const keystone = require('keystone');
const _ = require('lodash');

const Plant = keystone.list('Plant');
const PlantCategory = keystone.list('Category');
const Location = keystone.list('Location');
const herbariumSheet = XLSX.parse(path.join(__dirname, '../../seed/Herbarium.xlsx'));


function letterToColumns(input) {
  return input.charCodeAt(0) - 65;
}

const herbs = herbariumSheet[0]
.data
github moshang-xc / lottery / server / help.js View on Github external
const fs = require("fs");
const path = require("path");
const xlsx = require("node-xlsx").default;
let cwd = process.cwd();

/**
 * 读取缓存的数据内容
 */
function loadTempData() {
  let pros = [];
  pros.push(
    new Promise((resolve, reject) => {
      fs.readFile(path.join(cwd, "temp.json"), "utf8", (err, data) => {
        if (err) {
          resolve({});
          return;
        }
        resolve(JSON.parse(data));
      });

node-xlsx

NodeJS Excel files parser & builder

Apache-2.0
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis