Language: JavaScript
Label: safe
CWE: CWE-331 \u2014 Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.

Code:
        function PubNubFile(_a) {
            var stream = _a.stream, data = _a.data, encoding = _a.encoding, name = _a.name, mimeType = _a.mimeType;
            if (stream instanceof stream_1.Readable) {
                this.data = stream;
                if (stream instanceof fs_1.default.ReadStream) {
                    // $FlowFixMe: incomplete flow node definitions
                    this.name = (0, path_1.basename)(stream.path);
                    this.contentLength = fs_1.default.statSync(stream.path).size;
                }
            }
            else if (data instanceof Buffer) {
                this.data = Buffer.from(data);
            }
            else if (typeof data === 'string') {
                // $FlowFixMe: incomplete flow node definitions
                this.data = Buffer.from(data, encoding !== null && encoding !== void 0 ? encoding : 'utf8');
            }
            if (name) {
                this.name = (0, path_1.basename)(name);
            }
            if (mimeType) {
                this.mimeType = mimeType;
            }
            if (this.data === undefined) {
                throw new Error("Couldn't construct a file out of supplied options.");
            }
            if (this.name === undefined) {
                throw new Error("Couldn't guess filename out of the options. Please provide one.");
            }
        }