feat: Download picture on array keys

This commit is contained in:
Simon 2022-04-29 12:15:43 +02:00
parent 7d96eb23a6
commit 4e11f4a3c7
3 changed files with 2953 additions and 11 deletions

View File

@ -53,6 +53,10 @@ export default class DirectusToMarkdown {
if (typeof uuid === 'string' && uuid.match(uuidregex)) { if (typeof uuid === 'string' && uuid.match(uuidregex)) {
const filename = await this._downloadAsset(uuid, itemPath) const filename = await this._downloadAsset(uuid, itemPath)
item[key] = filename // Update field with filename instead of uuid item[key] = filename // Update field with filename instead of uuid
} else if (Array.isArray(uuid)) {
for (const element of uuid) {
await this._downloadAssets(element, itemPath)
}
} }
} }
} }

2956
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@resilien/directus-to-markdown", "name": "@resilien/directus-to-markdown",
"version": "1.1.0", "version": "1.2.0",
"description": "Export Directus items to markdown files with assets", "description": "Export Directus items to markdown files with assets",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -21,7 +21,7 @@
"license": "ISC", "license": "ISC",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@directus/sdk": "^9.5.2", "@directus/sdk": "^9.9.1",
"js-yaml": "^4.1.0" "js-yaml": "^4.1.0"
} }
} }