forked from souravkl11/Raganork-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexif.js
57 lines (55 loc) · 1.89 KB
/
exif.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Originally created by cwke
* Reuploaded by Waxaranai
* Recoded by SlavyanDesu
*
* GitHub is an open-source community, so why are you so triggered when someone shared some simple code?
*/
const fs = require('fs')
const packID = 'com.snowcorp.stickerly.android.stickercontentprovider b5e7275f-f1de-4137-961f-57becfad34f2'
const playstore = 'https://play.google.com/store/apps/details?id=com.pubg.newstate&hl=in&gl=US'
const itunes = 'https://apps.apple.com/us/app/pubg-mobile-3rd-anniversary/id1330123889'
/**
* @class Exif
*/
module.exports = class Exif {
/**
* Create an EXIF file.
* @param {String} packname
* @param {String} authorname
* @param {String} [filename=data]
*/
create(packname, authorname, filename) {
if (!filename) filename = 'data'
const json = {
'sticker-pack-id': packID,
'sticker-pack-name': packname,
'sticker-pack-publisher': authorname,
'android-app-store-link': playstore,
'ios-app-store-link': itunes
}
let len = JSON.stringify(json).length
const f = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00])
const code = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00]
if (len > 256) {
len = len - 256
code.unshift(0x01)
} else {
code.unshift(0x00)
}
const fff = Buffer.from(code)
const ffff = Buffer.from(JSON.stringify(json))
if (len < 16) {
len = len.toString(16)
len = '0' + len
} else {
len = len.toString(16)
}
const ff = Buffer.from(len, 'hex')
const buffer = Buffer.concat([f, ff, fff, ffff])
fs.writeFile(`./sourav/${filename}.exif`, buffer, (err) => {
if (err) return console.error(err)
console.log('Success!')
})
}
}