11qr-image
2- =========
2+ ========
33
44This is yet another QR Code generator.
55
@@ -17,35 +17,49 @@ Usage
1717-----
1818
1919Example:
20- ```
20+ ``` javascript
2121var qr = require (' qr-image' );
2222
2323var qr_svg = qr .image (' I love QR!' , { type: ' svg' });
2424qr_svg .pipe (require (' fs' ).createWriteStream (' i_love_qr.svg' ));
25+
26+ var svg_string = qr .imageSync (' I love QR!' , { type: ' svg' });
2527```
2628
2729[ More examples] ( ./examples )
2830
2931` qr = require('qr-image') `
3032
31- ` qr.image(text, [ec_level | options]) ` — returns Readable stream with image data.
32- ` qr.matrix(text, [ec_level]) ` — returns 2D array.
33+ ### Methods
34+
35+ * ` qr.image(text, [ec_level | options]) ` — Readable stream with image data;
36+ * ` qr.imageSync(text, [ec_level | options]) ` — string with image data. (not implemented for ` png ` );
37+ * ` qr.svgObject(text, [ec_level | options]) ` — object with SVG path and size;
38+ * ` qr.matrix(text, [ec_level]) ` — 2D array.
39+
40+
41+ ### Options
3342
3443 * ` text ` — text to encode;
3544 * ` ec_level ` — error correction level. One of ` L ` , ` M ` , ` Q ` , ` H ` . Default ` M ` .
3645 * ` options ` — image options object:
3746 * ` ec_level ` — default ` M ` .
38- * ` type ` — image type. Possible values ` png ` (default), ` svg ` ( ` svgpath ` ) , ` pdf ` and ` eps ` .
47+ * ` type ` — image type. Possible values ` png ` (default), ` svg ` , ` pdf ` and ` eps ` .
3948 * ` size ` (only png) — size of one module in pixels. Default ` 5 ` .
40- * ` margin ` (only png) — white space around QR image in modules. Default ` 4 ` .
49+ * ` margin ` — white space around QR image in modules. Default ` 4 ` for ` png ` and ` 1 ` for others .
4150 * ` customize ` (only png) — function to customize qr bitmap before encoding to PNG.
4251
43- ` svgpath ` is not really an image, but content of ` d ` attribute of corresponding SVG image.
52+ Changes
53+ -------
54+
55+ * ` svgpath ` type is deprecated. Use ` svgObject ` method instead.
56+ * ` margin ` option is used for vector formats.
4457
4558
4659TODO
4760----
4861
4962 * Tests;
63+ * ` imageSync ` for ` png ` .
5064 * mixing modes;
5165 * Kanji (???).
0 commit comments