@cyclonedx/cyclonedx-library
Version:
Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).
55 lines (51 loc) • 2.03 kB
TypeScript
/*!
This file is part of CycloneDX JavaScript Library.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright (c) OWASP Foundation. All Rights Reserved.
*/
/**
* This module tries to be as compatible as possible, it only uses basic methods that are known to be working in all FileSystem abstraction-layers.
* In addition, we use type parameters for all `PathLike`s, so downstream users can utilize their implementations accordingly.
*
* @module
*/
import type { Stats } from 'node:fs';
import { Attachment } from '../models/attachment';
export interface FsUtils<P extends string> {
readdirSync: (path: P) => P[];
readFileSync: (path: P) => Buffer;
statSync: (path: P) => Stats;
}
export interface PathUtils<P extends string> {
join: (...paths: P[]) => P;
}
export interface FileAttachment<P extends string> {
filePath: P;
file: P;
text: Attachment;
}
export type ErrorReporter = (e: Error) => any;
export declare class LicenseEvidenceGatherer<P extends string = string> {
#private;
/**
* `fs` and `path` can be supplied, if any compatibility-layer or drop-in replacement is used.
*
* @param options.fs - If omitted, the native `node:fs` is used.
* @param options.path - If omitted, the native `node:path` is used.
*/
constructor(options?: {
fs?: FsUtils<P>;
path?: PathUtils<P>;
});
getFileAttachments(prefixPath: P, onError?: ErrorReporter): Generator<FileAttachment<P>>;
}
//# sourceMappingURL=licenseUtility.node.d.ts.map