{"id":27392212,"url":"https://github.com/samt/barcode","last_synced_at":"2025-04-13T21:18:18.438Z","repository":{"id":5108078,"uuid":"6272021","full_name":"samt/barcode","owner":"samt","description":"barcode generation for nodejs","archived":false,"fork":false,"pushed_at":"2020-09-01T15:20:09.000Z","size":57,"stargazers_count":69,"open_issues_count":20,"forks_count":59,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-11T23:30:58.289Z","etag":null,"topics":["barcode-generator","javascript","upc"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"phacility/arcanist","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-18T02:39:15.000Z","updated_at":"2023-11-15T04:37:14.000Z","dependencies_parsed_at":"2022-07-05T03:31:37.430Z","dependency_job_id":null,"html_url":"https://github.com/samt/barcode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samt%2Fbarcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samt%2Fbarcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samt%2Fbarcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samt%2Fbarcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samt","download_url":"https://codeload.github.com/samt/barcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248591397,"owners_count":21130024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode-generator","javascript","upc"],"created_at":"2025-04-13T21:18:17.731Z","updated_at":"2025-04-13T21:18:18.421Z","avatar_url":"https://github.com/samt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# barcode generator [![Build Status](https://secure.travis-ci.org/samt/barcode.png)](http://travis-ci.org/samt/barcode)\n\nGenerate 1D and 2D barcodes\n\n## Supported 1D types\n\n* [Code39](http://en.wikipedia.org/wiki/Code39)\n* [Codabar](http://en.wikipedia.org/wiki/Codabar)\n* [Code128](http://en.wikipedia.org/wiki/Code128)\n* [UPC-A](http://en.wikipedia.org/wiki/Universal_Product_Code)\n* [UPC-E](http://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E)\n* [EAN-13](http://en.wikipedia.org/wiki/EAN)\n\n\n## Supported 2D types\n\n* [QR Code](http://en.wikipedia.org/wiki/QR_Code) (comming soon)\n* [DataMatrix](http://en.wikipedia.org/wiki/DataMatrix) (comming soon)\n* [PDF417](http://en.wikipedia.org/wiki/PDF417) (comming soon)\n\n## Requirements\n\n- A working installation of [GraphicsMagick](http://www.graphicsmagick.org/).\n- node \u003e= 0.10.0\n\n## Installing\n\n\tnpm install barcode\n\n## Usage\n\nSet it up and specify your type and options. The following 3 are the only\nrequired ones.\n\n```javascript\nvar barcode = require('barcode');\nvar code39 = barcode('code39', {\n\tdata: \"it works\",\n\twidth: 400,\n\theight: 100,\n});\n```\n\nNext choose from the three methods below how you want to output your barcode.\n\n**Stream**\n\nGet a stream of the final image data. you can collect this and save out a new\nPNG (default type), pipe it elsewhere, or save it to a CDN.\n\n```javascript\ncode39.getStream(function (err, readStream) {\n\tif (err) throw err;\n\n\t// 'readStream' is an instance of ReadableStream\n\treadStream.pipe(CdnWriteStream);\n});\n```\n\n**File to disk**\n\nSave an image out to the file system, pretty simple. Just be sure to specify\nyour outfile.\n\n```javascript\nvar outfile = path.join(__dirname, 'imgs', 'mycode.png')\ncode39.saveImage(outfile, function (err) {\n\tif (err) throw err;\n\n\tconsole.log('File has been written!');\n});\n```\n\n**Base64 encoded `img` src**\n\nOften times, barcodes are single use for a single print or whatever. With this\nmethod, we can create one on the fly and just send the base64 encoded image to\nthe browser through the HTML.\n\n```javascript\ncode39.getBase64(function (err, imgsrc) {\n\tif (err) throw err;\n\n\t// if we're using HTTP or another framework\n\tres.end('\u003cimg src=\"' + imgsrc + '\"\u003e');\n});\n```\n\n## Refactor\n\nMuch of the underlying code for the generation is being rewritten, however the\nAPI will remain the same. As a rule, anything new will have to be testable.\n\nThings todo:\n\n- Move all checksums and ECC to a module in lib/utils\n- Use the new barcode generation class: Barcode2D.js\n- Remove uses of Barcode1D and in-place image generation\n- Create separate functions for generating sequences\n\nIn the future:\n\n- Abstract drawing to be able to draw with `gm` or output html (bars with css\n\tor canvas)\n\n## License\n\n[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamt%2Fbarcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamt%2Fbarcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamt%2Fbarcode/lists"}