File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,17 @@ parsePng(fs.readFileSync('unicorn.png')).then(png => {
43
43
44
44
### parsePng(buffer, [ options] )
45
45
46
- Returns a promise for a PNG instance. See the [ pngjs documentation] ( https://github.com/lukeapage/pngjs#async-api ) for more information.
46
+ Returns a ` Promise ` for a PNG instance. See the [ pngjs documentation] ( https://github.com/lukeapage/pngjs#async-api ) for more information.
47
47
48
48
#### buffer
49
49
50
- Type: ` buffer `
50
+ Type: ` Buffer `
51
51
52
52
A PNG image buffer.
53
53
54
54
#### options
55
55
56
- Type: ` object `
56
+ Type: ` Object `
57
57
58
58
See the [ pngjs options] ( https://github.com/lukeapage/pngjs#options ) .
59
59
Original file line number Diff line number Diff line change 1
1
import fs from 'fs' ;
2
2
import fileType from 'file-type' ;
3
3
import getStream from 'get-stream' ;
4
- import pify from 'pify' ;
5
4
import test from 'ava' ;
6
5
import m from '.' ;
7
6
8
7
test ( 'parse' , async t => {
9
- const data = await m ( await pify ( fs . readFile ) ( './fixture.png' ) ) ;
8
+ const data = await m ( fs . readFileSync ( './fixture.png' ) ) ;
10
9
t . is ( data . width , 200 ) ;
11
10
t . is ( data . height , 133 ) ;
12
11
t . is ( data . depth , 8 ) ;
13
12
t . true ( Buffer . isBuffer ( data . data ) ) ;
14
13
} ) ;
15
14
16
15
test ( 'pack' , async t => {
17
- const png = await m ( await pify ( fs . readFile ) ( './fixture.png' ) ) ;
16
+ const png = await m ( fs . readFileSync ( './fixture.png' ) ) ;
18
17
t . deepEqual ( fileType ( await getStream . buffer ( png . pack ( ) ) ) , { ext : 'png' , mime : 'image/png' } ) ;
19
18
} ) ;
20
19
21
20
test ( 'parse interlaced png' , async t => {
22
- const data = await m ( await pify ( fs . readFile ) ( './fixture-interlaced.png' ) ) ;
21
+ const data = await m ( fs . readFileSync ( './fixture-interlaced.png' ) ) ;
23
22
t . true ( data . interlace ) ;
24
23
} ) ;
25
24
26
25
test ( 'pack interlaced png' , async t => {
27
- const png = await m ( await pify ( fs . readFile ) ( './fixture-interlaced.png' ) ) ;
26
+ const png = await m ( fs . readFileSync ( './fixture-interlaced.png' ) ) ;
28
27
t . deepEqual ( fileType ( await getStream . buffer ( png . pack ( ) ) ) , { ext : 'png' , mime : 'image/png' } ) ;
29
28
} ) ;
You can’t perform that action at this time.
0 commit comments