Merge pull request 'feat: Download picture on array keys' (#5) from picture_download into main

## Détails

- permet de télécharger les images depuis directus qui sont contenu dans un array

## Pourquoi

Pour faciliter l'import d'images

Reviewed-on: https://git.weko.io/resilien/directus-to-markdown/pulls/5
This commit is contained in:
Simon 2022-04-29 12:18:05 +02:00
commit 869c4f82c1
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"
} }
} }