Comparing version 2.20.4 to 2.20.9
{ | ||
"name": "telegram", | ||
"version": "2.20.4", | ||
"version": "2.20.9", | ||
"description": "NodeJS/Browser MTProto API Telegram client library,", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from "buffer/"; | ||
import type { DateLike } from "../define"; | ||
@@ -3,0 +3,0 @@ declare const snakeToCamelCase: (name: string) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.variableSnakeToCamelCase = exports.snakeToCamelCase = exports.CORE_TYPES = exports.fromLine = exports.buildArgConfig = exports.parseTl = exports.findAll = exports.serializeDate = exports.serializeBytes = void 0; | ||
const buffer_1 = require("buffer/"); | ||
const Helpers_1 = require("../Helpers"); | ||
@@ -70,3 +71,3 @@ const snakeToCamelCase = (name) => { | ||
} | ||
currentConfig.constructorId = (0, Helpers_1.crc32)(Buffer.from(representation, "utf8")); | ||
currentConfig.constructorId = (0, Helpers_1.crc32)(buffer_1.Buffer.from(representation, "utf8")); | ||
} | ||
@@ -241,5 +242,5 @@ for (const [brace, name, argType] of argsMatch) { | ||
function serializeBytes(data) { | ||
if (!(data instanceof Buffer)) { | ||
if (!(data instanceof buffer_1.Buffer)) { | ||
if (typeof data == "string") { | ||
data = Buffer.from(data); | ||
data = buffer_1.Buffer.from(data); | ||
} | ||
@@ -257,3 +258,3 @@ else { | ||
} | ||
r.push(Buffer.from([data.length])); | ||
r.push(buffer_1.Buffer.from([data.length])); | ||
r.push(data); | ||
@@ -266,3 +267,3 @@ } | ||
} | ||
r.push(Buffer.from([ | ||
r.push(buffer_1.Buffer.from([ | ||
254, | ||
@@ -275,4 +276,4 @@ data.length % 256, | ||
} | ||
r.push(Buffer.alloc(padding).fill(0)); | ||
return Buffer.concat(r); | ||
r.push(buffer_1.Buffer.alloc(padding).fill(0)); | ||
return buffer_1.Buffer.concat(r); | ||
} | ||
@@ -282,3 +283,3 @@ exports.serializeBytes = serializeBytes; | ||
if (!dt) { | ||
return Buffer.alloc(4).fill(0); | ||
return buffer_1.Buffer.alloc(4).fill(0); | ||
} | ||
@@ -289,3 +290,3 @@ if (dt instanceof Date) { | ||
if (typeof dt == "number") { | ||
const t = Buffer.alloc(4); | ||
const t = buffer_1.Buffer.alloc(4); | ||
t.writeInt32LE(dt, 0); | ||
@@ -292,0 +293,0 @@ return t; |
2076931
52381