{"_id":"@aidin36/xmp2js","name":"@aidin36/xmp2js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aidin36/xmp2js","version":"1.0.0","description":"Converts XMP to JS Object, and vice versa.","main":"index.js","types":"index.d.ts","scripts":{"tsc":"tsc","tsc:watch":"tsc --watch","pretty":"prettier './src/**/*.ts*' --write --config .prettierrc","lint":"eslint --quiet './src/**/*.ts*'","test":"jest"},"repository":{"type":"git","url":"git+https://github.com/aidin36/xmp2js.git"},"keywords":["xmp","metadata"],"author":{"name":"Aidin Gharibnavaz"},"license":"LGPL-3.0-or-later","bugs":{"url":"https://github.com/aidin36/xmp2js/issues"},"homepage":"https://github.com/aidin36/xmp2js#readme","volta":{"node":"22.12.0"},"devDependencies":{"@jest/globals":"29.7.0","@typescript-eslint/eslint-plugin":"8.20.0","@typescript-eslint/parser":"8.20.0","eslint":"8.57.1","eslint-config-airbnb":"19.0.4","eslint-config-prettier":"10.0.1","eslint-plugin-prettier":"5.2.1","eslint-plugin-tsdoc":"0.4.0","jest":"29.7.0","prettier":"3.4.2","ts-jest":"29.2.5","typescript":"5.7.3"},"dependencies":{"@xmldom/xmldom":"0.9.6"},"_id":"@aidin36/xmp2js@1.0.0","gitHead":"78a2e4f0da3b8add1c3862fc255b5ac85d65eeee","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-ZejZSE1jp/C3nd0qYcpID8OgcPiNWEzKFJ3g8g0p7UgCjuGeJ+VtdebFoeEkGmWSDATK22UsbPqX13of8Tl3PQ==","shasum":"52c570a2ebaaea3cf3ba11a6765f955c673d591a","tarball":"https://registry.npmjs.org/@aidin36/xmp2js/-/xmp2js-1.0.0.tgz","fileCount":7,"unpackedSize":20932,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCL+jhGz8uis9FLeuGtzJG52ItAflL4WRQUV/6Oa47ZdwIhAOxnU+cdeG8I3eVvT6fYhru10sJ39UI4axERJi+7Viuc"}]},"_npmUser":{"name":"aidin36","email":"aidin@aidinhut.com"},"directories":{},"maintainers":[{"name":"aidin36","email":"aidin@aidinhut.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/xmp2js_1.0.0_1736845825447_0.829557065448866"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-14T09:10:25.378Z","1.0.0":"2025-01-14T09:10:25.607Z","modified":"2025-01-14T09:10:25.849Z"},"maintainers":[{"name":"aidin36","email":"aidin@aidinhut.com"}],"description":"Converts XMP to JS Object, and vice versa.","homepage":"https://github.com/aidin36/xmp2js#readme","keywords":["xmp","metadata"],"repository":{"type":"git","url":"git+https://github.com/aidin36/xmp2js.git"},"author":{"name":"Aidin Gharibnavaz"},"bugs":{"url":"https://github.com/aidin36/xmp2js/issues"},"license":"LGPL-3.0-or-later","readme":"# Convert XMP to JS Object, and vice versa\n\nExtensible Metadata Platform (XMP) is a subset of RDF/XML. It's used to store metadata about media files (images and vides).\n\nIt's not easy to work with in Javascript (and Typescript). This package let you work with these metadata using JS Objects rather than XML.\n\nCurrently, it's tested and implemented based on IPTC standard. It should be able to parse any type of XMP because the data format is standard. But I didn't try it. Please open an `issue` if you encountered any problems.\n\n## Install\n\nUsing `npm`:\n\n```bash\nnpm install @aidin36/xmp2js\n```\n\n## API\n\nThe package provides two methods:\n\n### xmp2js\n\n```typescript\nxmp2js(xmpStr: string): XMP\n```\n\nIt converts an XMP to a JS Object. You can see the tests for some examples of how the output will look like. Check `tests/data/` directory. As a short example:\n\n```xml\n<Iptc4xmpExt:LocationCreated>\n <rdf:Bag>\n  <rdf:li rdf:parseType='Resource'>\n   <Iptc4xmpExt:City>City A</Iptc4xmpExt:City>\n   <Iptc4xmpExt:CountryCode>R23</Iptc4xmpExt:CountryCode>\n   <Iptc4xmpExt:LocationId>\n    <rdf:Bag>\n     <rdf:li>Location Id A</rdf:li>\n    </rdf:Bag>\n   </Iptc4xmpExt:LocationId>\n   <Iptc4xmpExt:LocationName>\n    <rdf:Alt>\n     <rdf:li xml:lang='x-default'>Location Name A</rdf:li>\n     <rdf:li xml:lang='fa-IR'>موقعیت مکانی اول</rdf:li>\n    </rdf:Alt>\n   </Iptc4xmpExt:LocationName>\n  </rdf:li>\n </rdf:Bag>\n</Iptc4xmpExt:LocationCreated>\n```\n\nThe above XMP will become this Object:\n\n```javascript\nLocationCreated: [\n  {\n    City: 'City A',\n    CountryCode: 'R23',\n    LocationId: ['Location Id A'],\n    LocationName: {\n      'x-default': 'Location Name A',\n      'fa-IR': 'موقعیت مکانی اول',\n    },\n  },\n]\n```\n\n### js2xmp\n\n```typescript\njs2xmp(jsObject: XMP): string\n```\n\nConverts a JS Object to XMP.\n\nThe JS Object should be in the same format as what xmp2js method produces.\n\nAt the moment, this method is not implemented.\n\n## Development\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nTo run the tests:\n\n```bash\nnpm test\n```\n\n## Copyright and License\n\nCopyright 2025 © Aidin Gharirbnavaz\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.\n","readmeFilename":"README.md"}