1
0
Fork 0
mirror of synced 2024-06-28 19:10:33 +12:00

fix csv import

This commit is contained in:
Martin McKeaveney 2020-10-14 13:09:03 +01:00
parent 72746c6e07
commit 2ae3191758
2 changed files with 10 additions and 9 deletions

View file

@ -7,6 +7,7 @@ const VALIDATORS = {
}
const PARSERS = {
number: attribute => Number(attribute),
datetime: attribute => new Date(attribute).toISOString(),
}
@ -24,7 +25,7 @@ function parse(path, parsers) {
}
}
})
result.fromFile(path).subscribe(row => {
result.subscribe((row, lineNumber) => {
// For each CSV row parse all the columns that need parsed
for (let key in parsers) {
if (!schema[key] || schema[key].success) {

View file

@ -1,5 +1,5 @@
const fs = require("fs")
const sharp = require("sharp")
// const sharp = require("sharp")
const fsPromises = fs.promises
const FORMATS = {
@ -7,14 +7,14 @@ const FORMATS = {
}
async function processImage(file) {
const imgMeta = await sharp(file.path)
.resize(300)
.toFile(file.outputPath)
// const imgMeta = await sharp(file.path)
// .resize(300)
// .toFile(file.outputPath)
return {
...file,
...imgMeta,
}
// return {
// ...file,
// ...imgMeta,
// }
}
async function process(file) {