Définition du module JS

This commit is contained in:
Simon Pistache 2023-05-10 08:26:04 +02:00
parent 69ec0da893
commit 67f2a9f474
4 changed files with 55 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Ignore node_module
**/node_modules/

21
src/build_job/package-lock.json generated Normal file
View File

@ -0,0 +1,21 @@
{
"name": "build_job",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "build_job",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"node-iptc": "^1.0.5"
}
},
"node_modules/node-iptc": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/node-iptc/-/node-iptc-1.0.5.tgz",
"integrity": "sha512-+e9aVETp/X8iFX2qBw2GnABkq/jGs7dJdxGURZysOdn4ZdOdArPW2a3xQpSq6GX2CcgEzUklDfaC/cg4sLv35g=="
}
}
}

View File

@ -0,0 +1,14 @@
{
"name": "build_job",
"version": "1.0.0",
"description": "Generate a theme.json file from the images' metadata of the working folder.",
"main": "themeset_builder.js",
"scripts": {
"test": "node themeset_builder.js"
},
"author": "Simon",
"license": "ISC",
"dependencies": {
"node-iptc": "^1.0.5"
}
}

View File

@ -0,0 +1,17 @@
const fs = require("fs");
const path = require("path");
const env = require("process")
const iptc = require('node-iptc');
// find all images
const slug = env.PACKAGE_NAME || "valid_set";
const root = env.ENTRY_FOLDER || "test";
let file = path.join(root, slug, "bl2_eridum_badlands_1.jpg");
// extract metadata from them
fs.readFile(file, function (err, data) {
if (err) { throw err }
var iptc_data = iptc(data);
console.log(iptc_data)
});