Skip to content

Commit ef79835

Browse files
gameromanghostdevv
andauthored
feat: add is-gzip to replacements (#696)
* feat: add `is-gzip` to replacements * Update manifests/micro-utilities.json --------- Co-authored-by: Willow (GHOST) <ghostdevbusiness@gmail.com>
1 parent ec16fd0 commit ef79835

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

manifests/micro-utilities.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@
174174
"description": "You can use `typeof` and `Object.prototype.toString.call` to check if a value is a generator function",
175175
"example": "const isGeneratorFunction = (obj) => typeof obj === \"function\" && Object.prototype.toString.call(obj) === \"[object GeneratorFunction]\""
176176
},
177+
"snippet::is-gzip-buffer": {
178+
"id": "snippet::is-gzip-buffer",
179+
"type": "simple",
180+
"description": "You can check first three bytes of a buffer to detect if it is a gzip file.",
181+
"example": "function isGzip(buf) {\n if (buf.length < 3) return false;\n return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;\n}"
182+
},
177183
"snippet::is-in-ssh": {
178184
"id": "snippet::is-in-ssh",
179185
"type": "simple",
@@ -539,6 +545,11 @@
539545
"moduleName": "is-generator-function",
540546
"replacements": ["snippet::is-generator-function"]
541547
},
548+
"is-gzip": {
549+
"type": "module",
550+
"moduleName": "is-gzip",
551+
"replacements": ["snippet::is-gzip-buffer"]
552+
},
542553
"is-in-ssh": {
543554
"type": "module",
544555
"moduleName": "is-in-ssh",

0 commit comments

Comments
 (0)