Loading src/fastboot.ts +5 −5 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ export class FastbootDevice { * @returns {Promise<CommandResponse>} Object containing response text and data size, if any. * @throws {FastbootError} */ private async readResponse() { private async readResponse(): Promise<CommandResponse> { let respData = {} as CommandResponse; let respStatus; Loading Loading @@ -318,7 +318,7 @@ export class FastbootDevice { * @returns {Promise<CommandResponse>} Object containing response text and data size, if any. * @throws {FastbootError} */ async runCommand(command: string) { async runCommand(command: string): Promise<CommandResponse> { // Command and response length is always 64 bytes regardless of protocol if (command.length > 64) { throw new RangeError(); Loading @@ -340,7 +340,7 @@ export class FastbootDevice { * @returns {Promise<string>} Textual content of the variable. * @throws {FastbootError} */ async getVariable(varName: string) { async getVariable(varName: string): Promise<string | null> { let resp; try { resp = ( Loading Loading @@ -372,7 +372,7 @@ export class FastbootDevice { * @returns {Promise<number>} * @throws {FastbootError} */ private async getDownloadSize() { private async getDownloadSize(): Promise<number> { try { let resp = ( await this.getVariable("max-download-size") Loading Loading @@ -476,7 +476,7 @@ export class FastbootDevice { * @param {boolean} wait - Whether to wait for the device to reconnect. * @param {ReconnectCallback} onReconnect - Callback to request device reconnection, if wait is enabled. */ async reboot(target = "", wait = false, onReconnect = () => {}) { async reboot(target: string = "", wait: boolean = false, onReconnect: ReconnectCallback = () => {}) { if (target.length > 0) { await this.runCommand(`reboot-${target}`); } else { Loading src/sparse.ts +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ export interface SparseChunk { * @param {ArrayBuffer} buffer - Raw file header data. * @returns {SparseHeader} Object containing the header information. */ export function parseFileHeader(buffer: ArrayBuffer) { export function parseFileHeader(buffer: ArrayBuffer): SparseHeader | null { let view = new DataView(buffer); let magic = view.getUint32(0, true); Loading Loading @@ -171,7 +171,7 @@ function createImage(header: SparseHeader, chunks: Array<SparseChunk>) { * @param {ArrayBuffer} rawBuffer - Buffer containing the raw image data. * @returns {ArrayBuffer} Buffer containing the new sparse image. */ export function fromRaw(rawBuffer: ArrayBuffer) { export function fromRaw(rawBuffer: ArrayBuffer): ArrayBuffer { let header = { blockSize: 4096, blocks: rawBuffer.byteLength / 4096, Loading Loading
src/fastboot.ts +5 −5 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ export class FastbootDevice { * @returns {Promise<CommandResponse>} Object containing response text and data size, if any. * @throws {FastbootError} */ private async readResponse() { private async readResponse(): Promise<CommandResponse> { let respData = {} as CommandResponse; let respStatus; Loading Loading @@ -318,7 +318,7 @@ export class FastbootDevice { * @returns {Promise<CommandResponse>} Object containing response text and data size, if any. * @throws {FastbootError} */ async runCommand(command: string) { async runCommand(command: string): Promise<CommandResponse> { // Command and response length is always 64 bytes regardless of protocol if (command.length > 64) { throw new RangeError(); Loading @@ -340,7 +340,7 @@ export class FastbootDevice { * @returns {Promise<string>} Textual content of the variable. * @throws {FastbootError} */ async getVariable(varName: string) { async getVariable(varName: string): Promise<string | null> { let resp; try { resp = ( Loading Loading @@ -372,7 +372,7 @@ export class FastbootDevice { * @returns {Promise<number>} * @throws {FastbootError} */ private async getDownloadSize() { private async getDownloadSize(): Promise<number> { try { let resp = ( await this.getVariable("max-download-size") Loading Loading @@ -476,7 +476,7 @@ export class FastbootDevice { * @param {boolean} wait - Whether to wait for the device to reconnect. * @param {ReconnectCallback} onReconnect - Callback to request device reconnection, if wait is enabled. */ async reboot(target = "", wait = false, onReconnect = () => {}) { async reboot(target: string = "", wait: boolean = false, onReconnect: ReconnectCallback = () => {}) { if (target.length > 0) { await this.runCommand(`reboot-${target}`); } else { Loading
src/sparse.ts +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ export interface SparseChunk { * @param {ArrayBuffer} buffer - Raw file header data. * @returns {SparseHeader} Object containing the header information. */ export function parseFileHeader(buffer: ArrayBuffer) { export function parseFileHeader(buffer: ArrayBuffer): SparseHeader | null { let view = new DataView(buffer); let magic = view.getUint32(0, true); Loading Loading @@ -171,7 +171,7 @@ function createImage(header: SparseHeader, chunks: Array<SparseChunk>) { * @param {ArrayBuffer} rawBuffer - Buffer containing the raw image data. * @returns {ArrayBuffer} Buffer containing the new sparse image. */ export function fromRaw(rawBuffer: ArrayBuffer) { export function fromRaw(rawBuffer: ArrayBuffer): ArrayBuffer { let header = { blockSize: 4096, blocks: rawBuffer.byteLength / 4096, Loading