File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,31 @@ void (async () => {
4242 console .log (items .response .docs )
4343})()
4444```
45-
45+ ### Create Item (Requires [ "S3-Like API Key"] ( https://archive.org/account/s3.php ) )
46+ ``` javascript
47+ import InternetArchive from ' internetarchive-sdk-js'
48+ const { IA_TOKEN } = process .env || {}
49+ const ia = new InternetArchive (IA_TOKEN , { testmode: true })
50+
51+ void (async () => {
52+ const filePath = ' ./generic-image.jpg'
53+ await ia .createItem ({
54+ identifier: ` generic-image-${ Date .now ()} ` ,
55+ collection: ' opensource_image' ,
56+ mediatype: ' image' ,
57+ upload: {
58+ filename: ' generic-image.jpg' ,
59+ path: filePath,
60+ },
61+ metadata: {
62+ title: ' Generic image' ,
63+ creator: ' Generic creator' ,
64+ subject: ' generic' ,
65+ },
66+ })
67+ })()
68+ ```
69+
4670### Update Item (Requires [ "S3-Like API Key"] ( https://archive.org/account/s3.php ) )
4771``` javascript
4872import InternetArchive from ' internetarchive-sdk-js'
You can’t perform that action at this time.
0 commit comments