@theia/ffmpeg 1.53.0-next.55 → 1.53.0-next.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,26 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- #ifndef MAC_FFMPEG
18
- #define MAC_FFMPEG
19
-
20
- /**
21
- * Mac seems to use the same libraries as Linux.
22
- * Difference is that the compiler doesn't need to be told to use `-ldl`.
23
- */
24
- #include "./linux-ffmpeg.c"
25
-
26
- #endif // MAC_FFMPEG guard
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ #ifndef MAC_FFMPEG
18
+ #define MAC_FFMPEG
19
+
20
+ /**
21
+ * Mac seems to use the same libraries as Linux.
22
+ * Difference is that the compiler doesn't need to be told to use `-ldl`.
23
+ */
24
+ #include "./linux-ffmpeg.c"
25
+
26
+ #endif // MAC_FFMPEG guard
@@ -1,77 +1,77 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
- #ifndef WIN_FFMPEG
17
- #define WIN_FFMPEG
18
-
19
- #include <windows.h>
20
-
21
- #include "ffmpeg.h"
22
-
23
- static char *error_library_not_found = "shared library not found";
24
- static char *error_function_not_found = "function not found in shared library";
25
- static char *error_cannot_free_library = "cannot free shared library";
26
-
27
- char *load_ffmpeg_library(struct FFMPEG_Library *library, char *library_path)
28
- {
29
- char *error = NULL;
30
-
31
- HMODULE handle = LoadLibrary(library_path);
32
- if (!handle)
33
- {
34
- error = error_library_not_found;
35
- goto error;
36
- }
37
-
38
- struct AVCodecDescriptor *(*av_codec_next)(const struct AVCodecDescriptor *) = (struct AVCodecDescriptor * (*)(const struct AVCodecDescriptor *))
39
- GetProcAddress(handle, "avcodec_descriptor_next");
40
- if (!av_codec_next)
41
- {
42
- error = error_function_not_found;
43
- goto error;
44
- }
45
-
46
- struct AVCodec *(*avcodec_find_decoder)(enum AVCodecID) = (struct AVCodec * (*)(enum AVCodecID))
47
- GetProcAddress(handle, "avcodec_find_decoder");
48
- if (!avcodec_find_decoder)
49
- {
50
- error = error_function_not_found;
51
- goto error;
52
- }
53
-
54
- library->handle = handle;
55
- library->avcodec_descriptor_next = av_codec_next;
56
- library->avcodec_find_decoder = avcodec_find_decoder;
57
- return NULL;
58
-
59
- error:
60
- if (handle)
61
- {
62
- FreeLibrary(handle);
63
- }
64
- return error;
65
- }
66
-
67
- char *unload_ffmpeg_library(struct FFMPEG_Library *library)
68
- {
69
- if (library->handle && FreeLibrary(library->handle))
70
- {
71
- *library = NULL_FFMPEG_LIBRARY;
72
- return NULL;
73
- }
74
- return error_cannot_free_library;
75
- }
76
-
77
- #endif // WIN_FFMPEG guard
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+ #ifndef WIN_FFMPEG
17
+ #define WIN_FFMPEG
18
+
19
+ #include <windows.h>
20
+
21
+ #include "ffmpeg.h"
22
+
23
+ static char *error_library_not_found = "shared library not found";
24
+ static char *error_function_not_found = "function not found in shared library";
25
+ static char *error_cannot_free_library = "cannot free shared library";
26
+
27
+ char *load_ffmpeg_library(struct FFMPEG_Library *library, char *library_path)
28
+ {
29
+ char *error = NULL;
30
+
31
+ HMODULE handle = LoadLibrary(library_path);
32
+ if (!handle)
33
+ {
34
+ error = error_library_not_found;
35
+ goto error;
36
+ }
37
+
38
+ struct AVCodecDescriptor *(*av_codec_next)(const struct AVCodecDescriptor *) = (struct AVCodecDescriptor * (*)(const struct AVCodecDescriptor *))
39
+ GetProcAddress(handle, "avcodec_descriptor_next");
40
+ if (!av_codec_next)
41
+ {
42
+ error = error_function_not_found;
43
+ goto error;
44
+ }
45
+
46
+ struct AVCodec *(*avcodec_find_decoder)(enum AVCodecID) = (struct AVCodec * (*)(enum AVCodecID))
47
+ GetProcAddress(handle, "avcodec_find_decoder");
48
+ if (!avcodec_find_decoder)
49
+ {
50
+ error = error_function_not_found;
51
+ goto error;
52
+ }
53
+
54
+ library->handle = handle;
55
+ library->avcodec_descriptor_next = av_codec_next;
56
+ library->avcodec_find_decoder = avcodec_find_decoder;
57
+ return NULL;
58
+
59
+ error:
60
+ if (handle)
61
+ {
62
+ FreeLibrary(handle);
63
+ }
64
+ return error;
65
+ }
66
+
67
+ char *unload_ffmpeg_library(struct FFMPEG_Library *library)
68
+ {
69
+ if (library->handle && FreeLibrary(library->handle))
70
+ {
71
+ *library = NULL_FFMPEG_LIBRARY;
72
+ return NULL;
73
+ }
74
+ return error_cannot_free_library;
75
+ }
76
+
77
+ #endif // WIN_FFMPEG guard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/ffmpeg",
3
- "version": "1.53.0-next.55+d1a989a68c",
3
+ "version": "1.53.0-next.64+23b351d26",
4
4
  "description": "Theia FFMPEG reader utility.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@types/unzipper": "^0.9.2"
37
37
  },
38
- "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
38
+ "gitHead": "23b351d26346a2b5d6aca3ee81fba59c056132f7"
39
39
  }
@@ -1,56 +1,56 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as ffmpeg from './ffmpeg';
18
-
19
- export interface CheckFfmpegOptions extends ffmpeg.FfmpegOptions {
20
- json?: boolean
21
- }
22
-
23
- export interface CheckFfmpegResult {
24
- free: ffmpeg.Codec[],
25
- proprietary: ffmpeg.Codec[],
26
- }
27
-
28
- export const KNOWN_PROPRIETARY_CODECS = new Set(['h264', 'aac']);
29
-
30
- export async function checkFfmpeg(options: CheckFfmpegOptions = {}): Promise<void> {
31
- const {
32
- ffmpegPath = ffmpeg.ffmpegAbsolutePath(options),
33
- json = false,
34
- } = options;
35
- const codecs = ffmpeg.getFfmpegCodecs(ffmpegPath);
36
- const free = [];
37
- const proprietary = [];
38
- for (const codec of codecs) {
39
- if (KNOWN_PROPRIETARY_CODECS.has(codec.name.toLowerCase())) {
40
- proprietary.push(codec);
41
- } else {
42
- free.push(codec);
43
- }
44
- }
45
- if (json) {
46
- // Pretty format JSON on stdout.
47
- const result: CheckFfmpegResult = { free, proprietary };
48
- console.log(JSON.stringify(result, undefined, 2));
49
- }
50
- if (proprietary.length > 0) {
51
- // Should be displayed on stderr to not pollute the JSON on stdout.
52
- throw new Error(`${proprietary.length} proprietary codecs found\n${proprietary.map(codec => `> ${codec.name} detected (${codec.longName})`).join('\n')}`);
53
- }
54
- // Print to stderr to not pollute the JSON on stdout.
55
- console.warn(`"${ffmpegPath}" does not contain proprietary codecs (${codecs.length} found).`);
56
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as ffmpeg from './ffmpeg';
18
+
19
+ export interface CheckFfmpegOptions extends ffmpeg.FfmpegOptions {
20
+ json?: boolean
21
+ }
22
+
23
+ export interface CheckFfmpegResult {
24
+ free: ffmpeg.Codec[],
25
+ proprietary: ffmpeg.Codec[],
26
+ }
27
+
28
+ export const KNOWN_PROPRIETARY_CODECS = new Set(['h264', 'aac']);
29
+
30
+ export async function checkFfmpeg(options: CheckFfmpegOptions = {}): Promise<void> {
31
+ const {
32
+ ffmpegPath = ffmpeg.ffmpegAbsolutePath(options),
33
+ json = false,
34
+ } = options;
35
+ const codecs = ffmpeg.getFfmpegCodecs(ffmpegPath);
36
+ const free = [];
37
+ const proprietary = [];
38
+ for (const codec of codecs) {
39
+ if (KNOWN_PROPRIETARY_CODECS.has(codec.name.toLowerCase())) {
40
+ proprietary.push(codec);
41
+ } else {
42
+ free.push(codec);
43
+ }
44
+ }
45
+ if (json) {
46
+ // Pretty format JSON on stdout.
47
+ const result: CheckFfmpegResult = { free, proprietary };
48
+ console.log(JSON.stringify(result, undefined, 2));
49
+ }
50
+ if (proprietary.length > 0) {
51
+ // Should be displayed on stderr to not pollute the JSON on stdout.
52
+ throw new Error(`${proprietary.length} proprietary codecs found\n${proprietary.map(codec => `> ${codec.name} detected (${codec.longName})`).join('\n')}`);
53
+ }
54
+ // Print to stderr to not pollute the JSON on stdout.
55
+ console.warn(`"${ffmpegPath}" does not contain proprietary codecs (${codecs.length} found).`);
56
+ }
package/src/ffmpeg.ts CHANGED
@@ -1,114 +1,114 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import path = require('path');
18
-
19
- export interface Codec {
20
- id: number
21
- name: string
22
- longName: string
23
- }
24
-
25
- export interface FfmpegNativeAddon {
26
- codecs(ffmpegPath: string): Codec[]
27
- }
28
-
29
- export interface FfmpegNameAndLocation {
30
- /**
31
- * Name with extension of the shared library.
32
- */
33
- name: string
34
- /**
35
- * Relative location of the file from Electron's dist root.
36
- */
37
- location: string
38
- }
39
-
40
- export interface FfmpegOptions {
41
- electronVersion?: string
42
- electronDist?: string
43
- ffmpegPath?: string
44
- platform?: NodeJS.Platform
45
- }
46
-
47
- /**
48
- * @internal
49
- */
50
- export function _loadFfmpegNativeAddon(): FfmpegNativeAddon {
51
- try {
52
- return require('../build/Release/ffmpeg.node');
53
- } catch (error) {
54
- if (error.code === 'MODULE_NOT_FOUND') {
55
- return require('../build/Debug/ffmpeg.node');
56
- } else {
57
- throw error;
58
- }
59
- }
60
- }
61
-
62
- /**
63
- * @returns name and relative path from Electron's root where FFMPEG is located at.
64
- */
65
- export function ffmpegNameAndLocation({
66
- platform = process.platform
67
- }: FfmpegOptions = {}): FfmpegNameAndLocation {
68
- switch (platform) {
69
- case 'darwin':
70
- return {
71
- name: 'libffmpeg.dylib',
72
- location: 'Electron.app/Contents/Frameworks/Electron Framework.framework/Libraries/',
73
- };
74
- case 'win32':
75
- return {
76
- name: 'ffmpeg.dll',
77
- location: '',
78
- };
79
- case 'linux':
80
- return {
81
- name: 'libffmpeg.so',
82
- location: '',
83
- };
84
- default:
85
- throw new Error(`${platform} is not supported`);
86
- }
87
- }
88
-
89
- /**
90
- * @returns relative ffmpeg shared library path from the Electron distribution root.
91
- */
92
- export function ffmpegRelativePath(options: FfmpegOptions = {}): string {
93
- const { location, name } = ffmpegNameAndLocation(options);
94
- return path.join(location, name);
95
- }
96
-
97
- /**
98
- * @returns absolute ffmpeg shared library path.
99
- */
100
- export function ffmpegAbsolutePath(options: FfmpegOptions = {}): string {
101
- const {
102
- electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist')
103
- } = options;
104
- return path.join(electronDist, ffmpegRelativePath(options));
105
- }
106
-
107
- /**
108
- * Dynamically link to `ffmpegPath` and use FFMPEG APIs to list the included `Codec`s.
109
- * @param ffmpegPath absolute path the the FFMPEG shared library.
110
- * @returns list of codecs for the given ffmpeg shared library.
111
- */
112
- export function getFfmpegCodecs(ffmpegPath: string): Codec[] {
113
- return _loadFfmpegNativeAddon().codecs(ffmpegPath);
114
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import path = require('path');
18
+
19
+ export interface Codec {
20
+ id: number
21
+ name: string
22
+ longName: string
23
+ }
24
+
25
+ export interface FfmpegNativeAddon {
26
+ codecs(ffmpegPath: string): Codec[]
27
+ }
28
+
29
+ export interface FfmpegNameAndLocation {
30
+ /**
31
+ * Name with extension of the shared library.
32
+ */
33
+ name: string
34
+ /**
35
+ * Relative location of the file from Electron's dist root.
36
+ */
37
+ location: string
38
+ }
39
+
40
+ export interface FfmpegOptions {
41
+ electronVersion?: string
42
+ electronDist?: string
43
+ ffmpegPath?: string
44
+ platform?: NodeJS.Platform
45
+ }
46
+
47
+ /**
48
+ * @internal
49
+ */
50
+ export function _loadFfmpegNativeAddon(): FfmpegNativeAddon {
51
+ try {
52
+ return require('../build/Release/ffmpeg.node');
53
+ } catch (error) {
54
+ if (error.code === 'MODULE_NOT_FOUND') {
55
+ return require('../build/Debug/ffmpeg.node');
56
+ } else {
57
+ throw error;
58
+ }
59
+ }
60
+ }
61
+
62
+ /**
63
+ * @returns name and relative path from Electron's root where FFMPEG is located at.
64
+ */
65
+ export function ffmpegNameAndLocation({
66
+ platform = process.platform
67
+ }: FfmpegOptions = {}): FfmpegNameAndLocation {
68
+ switch (platform) {
69
+ case 'darwin':
70
+ return {
71
+ name: 'libffmpeg.dylib',
72
+ location: 'Electron.app/Contents/Frameworks/Electron Framework.framework/Libraries/',
73
+ };
74
+ case 'win32':
75
+ return {
76
+ name: 'ffmpeg.dll',
77
+ location: '',
78
+ };
79
+ case 'linux':
80
+ return {
81
+ name: 'libffmpeg.so',
82
+ location: '',
83
+ };
84
+ default:
85
+ throw new Error(`${platform} is not supported`);
86
+ }
87
+ }
88
+
89
+ /**
90
+ * @returns relative ffmpeg shared library path from the Electron distribution root.
91
+ */
92
+ export function ffmpegRelativePath(options: FfmpegOptions = {}): string {
93
+ const { location, name } = ffmpegNameAndLocation(options);
94
+ return path.join(location, name);
95
+ }
96
+
97
+ /**
98
+ * @returns absolute ffmpeg shared library path.
99
+ */
100
+ export function ffmpegAbsolutePath(options: FfmpegOptions = {}): string {
101
+ const {
102
+ electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist')
103
+ } = options;
104
+ return path.join(electronDist, ffmpegRelativePath(options));
105
+ }
106
+
107
+ /**
108
+ * Dynamically link to `ffmpegPath` and use FFMPEG APIs to list the included `Codec`s.
109
+ * @param ffmpegPath absolute path the the FFMPEG shared library.
110
+ * @returns list of codecs for the given ffmpeg shared library.
111
+ */
112
+ export function getFfmpegCodecs(ffmpegPath: string): Codec[] {
113
+ return _loadFfmpegNativeAddon().codecs(ffmpegPath);
114
+ }
package/src/hash.ts CHANGED
@@ -1,28 +1,28 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import crypto = require('crypto');
18
- import fs = require('fs-extra');
19
-
20
- export async function hashFile(filePath: string): Promise<Buffer> {
21
- return new Promise((resolve, reject) => {
22
- const sha256 = crypto.createHash('sha256');
23
- fs.createReadStream(filePath)
24
- .on('close', () => resolve(sha256.digest()))
25
- .on('data', data => sha256.update(data))
26
- .on('error', reject);
27
- });
28
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import crypto = require('crypto');
18
+ import fs = require('fs-extra');
19
+
20
+ export async function hashFile(filePath: string): Promise<Buffer> {
21
+ return new Promise((resolve, reject) => {
22
+ const sha256 = crypto.createHash('sha256');
23
+ fs.createReadStream(filePath)
24
+ .on('close', () => resolve(sha256.digest()))
25
+ .on('data', data => sha256.update(data))
26
+ .on('error', reject);
27
+ });
28
+ }