{"_id":"@altech-hk/node-sd-webui","_rev":"3-9b4ea3228514ca13855f43446319801a","name":"@altech-hk/node-sd-webui","dist-tags":{"latest":"0.0.8-d"},"versions":{"0.0.8-a":{"name":"@altech-hk/node-sd-webui","description":"Node.js client for AUTOMATIC1111's Stable Diffusion Web UI","version":"0.0.8-a","type":"module","license":"MIT","engines":{"node":">=18"},"scripts":{"build:json":"json -f ./dist/package.json -I -e \"delete this.type; delete this.ava; delete this.devDependencies; delete this.scripts\"","build:copy-files":"cp package.json ./dist/package.json &&  cp README.md ./dist/README.md && cp LICENSE ./dist/LICENSE","build":"rm -rf ./dist && tsc --project tsconfig.esm.json & tsc --project tsconfig.cjs.json && pnpm run build:copy-files && pnpm run build:json","test":"ava"},"devDependencies":{"@types/node":"^18.13.0","ava":"^5.2.0","json":"^11.0.0","ts-node":"^10.9.1","typescript":"^4.9.3"},"ava":{"timeout":"60s","extensions":{"ts":"module"},"nodeArguments":["--loader=ts-node/esm"]},"types":"./types/index.d.ts","exports":{"import":"./esm/index.js","require":"./cjs/index.js","default":"./esm/index.js"},"_id":"@altech-hk/node-sd-webui@0.0.8-a","gitHead":"f5d7017514ef7189141719ad534475b45c025632","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-KXZ7Fi0wSoLxlAAax7TK5cldXJmGU2/waQg0mTC/HwozbZ7CNt8EKSnd03PpxWgy++G85poG3dCnp3UoB+h1qw==","shasum":"57b2613bcf80d13fcff5518ae447673227482cd2","tarball":"https://registry.npmjs.org/@altech-hk/node-sd-webui/-/node-sd-webui-0.0.8-a.tgz","fileCount":20,"unpackedSize":798131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFYhkm5urUDyhWwSZ2llxx1RdUDcTZJpnzt4l1OYE74DAiB0drlELC8sSM0pXHPph0jCpB7joRaKmdEXoaBLAkqnYg=="}]},"_npmUser":{"name":"altech-hk","email":"cs@altech.hk"},"directories":{},"maintainers":[{"name":"altech-hk","email":"cs@altech.hk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-sd-webui_0.0.8-a_1708051280880_0.7246714630593671"},"_hasShrinkwrap":false},"0.0.8-b":{"name":"@altech-hk/node-sd-webui","description":"Node.js client for AUTOMATIC1111's Stable Diffusion Web UI","version":"0.0.8-b","type":"module","license":"MIT","engines":{"node":">=18"},"scripts":{"build:json":"json -f ./dist/package.json -I -e \"delete this.type; delete this.ava; delete this.devDependencies; delete this.scripts\"","build:copy-files":"cp package.json ./dist/package.json &&  cp README.md ./dist/README.md && cp LICENSE ./dist/LICENSE","build":"rm -rf ./dist && tsc --project tsconfig.esm.json & tsc --project tsconfig.cjs.json && pnpm run build:copy-files && pnpm run build:json","test":"ava"},"devDependencies":{"@types/node":"^18.13.0","ava":"^5.2.0","json":"^11.0.0","ts-node":"^10.9.1","typescript":"^4.9.3"},"ava":{"timeout":"60s","extensions":{"ts":"module"},"nodeArguments":["--loader=ts-node/esm"]},"types":"./types/index.d.ts","exports":{"import":"./esm/index.js","require":"./cjs/index.js","default":"./esm/index.js"},"_id":"@altech-hk/node-sd-webui@0.0.8-b","gitHead":"8cafa95cc3e975522f2e75e2f5161fb49fb0e8f6","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-OAshXP0rnP/YxuXzWB5p9NboIIDbvp9VQrPBY/77Mcc6ixde2weufg5klPuQaJhasGKKcTiKUyVOc7vYdsMbnA==","shasum":"f111e790a2a1aefa1d7fc51f24c60bbe988d4255","tarball":"https://registry.npmjs.org/@altech-hk/node-sd-webui/-/node-sd-webui-0.0.8-b.tgz","fileCount":20,"unpackedSize":798131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClE57agrGz8tiqqElpptWbC2pyyDsHBbPgXMhEZq9KAwIgUrEnxhT40NkG6eglpHfDvsRnLn4pT2Vqa0KjXrw/mZY="}]},"_npmUser":{"name":"altech-hk","email":"cs@altech.hk"},"directories":{},"maintainers":[{"name":"altech-hk","email":"cs@altech.hk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-sd-webui_0.0.8-b_1708051414405_0.8503035688903773"},"_hasShrinkwrap":false},"0.0.8-c":{"name":"@altech-hk/node-sd-webui","description":"Node.js client for AUTOMATIC1111's Stable Diffusion Web UI","version":"0.0.8-c","type":"module","license":"MIT","engines":{"node":">=18"},"scripts":{"build:json":"json -f ./dist/package.json -I -e \"delete this.type; delete this.ava; delete this.devDependencies; delete this.scripts\"","build:copy-files":"cp package.json ./dist/package.json &&  cp README.md ./dist/README.md && cp LICENSE ./dist/LICENSE","build":"rm -rf ./dist && tsc --project tsconfig.esm.json & tsc --project tsconfig.cjs.json && pnpm run build:copy-files && pnpm run build:json","test":"ava"},"devDependencies":{"@types/node":"^18.13.0","ava":"^5.2.0","json":"^11.0.0","ts-node":"^10.9.1","typescript":"^4.9.3"},"ava":{"timeout":"60s","extensions":{"ts":"module"},"nodeArguments":["--loader=ts-node/esm"]},"types":"./types/index.d.ts","exports":{"import":"./esm/index.js","require":"./cjs/index.js","default":"./esm/index.js"},"_id":"@altech-hk/node-sd-webui@0.0.8-c","gitHead":"b48e2e21f2e146b347fc3ce76a44a391efe867aa","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-pKmdX5vpe72NNmOv8z9qk0Qr+oa2AGBvaQPEBo9tthzJ0dRlOd9mpxtTdIPipxK0ItZLkz8DgGcFqQnfHsv/lQ==","shasum":"7b96acc5e10600b0fb06ff0507905a76ac0c1a38","tarball":"https://registry.npmjs.org/@altech-hk/node-sd-webui/-/node-sd-webui-0.0.8-c.tgz","fileCount":44,"unpackedSize":826021,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFiSBt5/bkE2blAa/Sbo7GqiljsUeJBiZbHUXEDvT5cyAiEAm38YNFoQdzx40agfd+ap5UgHONyCa77OsVUwdOa3U10="}]},"_npmUser":{"name":"altech-hk","email":"cs@altech.hk"},"directories":{},"maintainers":[{"name":"altech-hk","email":"cs@altech.hk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-sd-webui_0.0.8-c_1708051592745_0.09377633582121137"},"_hasShrinkwrap":false},"0.0.8-d":{"name":"@altech-hk/node-sd-webui","description":"Node.js client for AUTOMATIC1111's Stable Diffusion Web UI","version":"0.0.8-d","license":"MIT","engines":{"node":">=18"},"types":"./types/index.d.ts","exports":{"import":"./esm/index.js","require":"./cjs/index.js","default":"./esm/index.js"},"_id":"@altech-hk/node-sd-webui@0.0.8-d","gitHead":"dcdf6785e254a5aa65a36e044a0c98fc1050cb5f","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-8OrKpma0wHO6WlPZ4RegGZGr6OjgtPaCa+tQbO+A921raFq3PRvEjm2TGIlwYqfKsn9dfwhCMaCZdr/X/JMTAA==","shasum":"abe312ee4f193a7f59f7086be2120dcc4ad2ff6b","tarball":"https://registry.npmjs.org/@altech-hk/node-sd-webui/-/node-sd-webui-0.0.8-d.tgz","fileCount":24,"unpackedSize":27890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAp137/Vl9PjkcZ1LDMs5KCBgJI8chLgzr+sIVJ7dobPAiBIt+kMza2PkvqNtOeitIsh3GrmE5jSi31yf5AvoTbtDg=="}]},"_npmUser":{"name":"altech-hk","email":"cs@altech.hk"},"directories":{},"maintainers":[{"name":"altech-hk","email":"cs@altech.hk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-sd-webui_0.0.8-d_1708051974473_0.7570062941222448"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-16T02:41:20.763Z","0.0.8-a":"2024-02-16T02:41:21.149Z","modified":"2024-02-16T02:52:55.326Z","0.0.8-b":"2024-02-16T02:43:34.674Z","0.0.8-c":"2024-02-16T02:46:32.983Z","0.0.8-d":"2024-02-16T02:52:54.699Z"},"maintainers":[{"name":"altech-hk","email":"cs@altech.hk"}],"description":"Node.js client for AUTOMATIC1111's Stable Diffusion Web UI","license":"MIT","readme":"# Node Stable Diffusion Web UI Client\n\n[![npm version](https://badge.fury.io/js/node-sd-webui.svg)](https://www.npmjs.com/package/node-sd-webui)\n\nA Node.js client for using Automatic1111's Stable Diffusion Web UI.\n\n## Current Features\n\nThis project is a work in progress. Current features include:\n\n- [x] txt2img generation\n- [x] img2img generation\n- [x] pngInfo support\n\n### Extensions\n\n- [x] ControlNet support both txt2img and img2img\n\n## Getting Started\n\n### Requirements\n\n- Node.js >= 18\n- Automatic1111's\n  [Stable Diffusion Web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui/)\n- ControlNet support requires\n  [sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet)\n\n### Enable Stable Diffusion WebUI's API\n\nIn order to use the API, you first need to enable it. You can do so by appending\n`--api` to the command line arguments when running the webui.\n\nFor Linux: `[webui-folder]/webui-user.sh`\n\n```sh\nexport COMMANDLINE_ARGS=\"--api\"\n```\n\nFor Windows: `[webui-folder]/webui-user.bat`\n\n```bat\nset COMMANDLINE_ARGS=--api\n```\n\n### Installation\n\nAdd `node-sd-webui` to your project.\n\nUsing npm:\n\n```sh\nnpm i -S node-sd-webui\n```\n\nUsing yarn:\n\n```sh\nyarn add node-sd-webui\n```\n\nUsing pnpm:\n\n```sh\npnpm add node-sd-webui\n```\n\n## Usage\n\n### txt2img\n\nThe `txt2img` function allows you to generate an image using the `txt2img`\nfunctionality of the Stable Diffusion WebUI.\n\nBasic Example:\n\n```js\nimport sdwebui from 'node-sd-webui'\nimport { writeFileSync } from 'fs'\n\nsdwebui()\n  .txt2img({\n    prompt: 'A photo of a mushroom',\n  })\n  .then(({ images }) => writeFileSync('path/to/image.png', images[0], 'base64'))\n  .catch((err) => console.error(err))\n```\n\nAnother example with a few more options:\n\n```js\nimport sdwebui, { SamplingMethod } from 'node-sd-webui'\nimport { writeFileSync } from 'fs'\n\nconst client = sdwebui()\n\ntry {\n  const { images } = await client.txt2img({\n    prompt: 'A photo of a mushroom, red cap, white spots',\n    negativePrompt: 'blurry, cartoon, drawing, illustration',\n    samplingMethod: SamplingMethod.Euler_A,\n    width: 768,\n    height: 512,\n    steps: 20,\n    batchSize: 5,\n  })\n\n  images.forEach((image, i) =>\n    writeFileSync(`path/to/image-${i}.png`, images[i], 'base64')\n  )\n} catch (err) {\n  console.error(err)\n}\n```\n","readmeFilename":"README.md"}