repl.it
Nodejs

No description

fork
loading
Files
  • index.js
  • k.webp
  • s.webp
  • Packager files
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const sharp = require("sharp")
const fs = require("fs")



let bitmap = fs.readFileSync("s.webp");
// convert binary data to base64 encoded string
let img = Buffer.from(bitmap).toString('base64');

img = Buffer.from(img, "base64")


// let d = sharp(img).resize({width: 500}).toBuffer((err, data, info) => {
//   let c = data.toString("base64")

//   fs.writeFileSync("k.webp", Buffer.from(c, "base64"))
// });


sharp(img).metadata((err, meta) => {
  console.log(meta)
  console.log(meta.width)
})


// console.log(d)
?