Skip to content
Snippets Groups Projects
Commit cfe690a7 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

create folders and zip

parent 50026400
No related branches found
No related tags found
No related merge requests found
const AWS = require('aws-sdk') const AWS = require('aws-sdk')
// const logger = require('@pubsweet/logger')
const _ = require('lodash') const _ = require('lodash')
const util = require('util') const util = require('util')
const config = require('config') const config = require('config')
const archiver = require('archiver') const archiver = require('archiver')
// const logger = require('@pubsweet/logger')
const s3Config = _.get(config, 'pubsweet-component-aws-s3') const s3Config = _.get(config, 'pubsweet-component-aws-s3')
...@@ -43,9 +43,12 @@ const FileBackend = app => { ...@@ -43,9 +43,12 @@ const FileBackend = app => {
), ),
).then(files => { ).then(files => {
files.forEach((file, index) => { files.forEach((file, index) => {
archive.append(file.Body, { name: file.ETag }) archive.append(file.Body, {
name: `${_.get(file, 'Metadata.filetype') ||
'supplementary'}/${_.get(file, 'Metadata.filename') ||
file.ETag}`,
})
}) })
archive.finalize() archive.finalize()
}) })
}) })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment