mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
New updates and modules
This commit is contained in:
parent
4d5d408898
commit
0abf0f90f6
959 changed files with 364301 additions and 17493 deletions
21
node_modules/level-js/util/serialize.js
generated
vendored
Normal file
21
node_modules/level-js/util/serialize.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
'use strict'
|
||||
|
||||
var Buffer = require('buffer').Buffer
|
||||
// Returns either a Uint8Array or Buffer (doesn't matter to
|
||||
// IndexedDB, because Buffer is a subclass of Uint8Array)
|
||||
var str2bin = (function () {
|
||||
if (global.TextEncoder) {
|
||||
var encoder = new TextEncoder('utf-8')
|
||||
return encoder.encode.bind(encoder)
|
||||
} else {
|
||||
return Buffer.from
|
||||
}
|
||||
})()
|
||||
|
||||
module.exports = function (data, asBuffer) {
|
||||
if (asBuffer) {
|
||||
return Buffer.isBuffer(data) ? data : str2bin(String(data))
|
||||
} else {
|
||||
return String(data)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue