UNPKG

@storm-software/cloudflare-tools

Version:

A Nx plugin package that contains various executors, generators, and utilities that assist in managing Cloudflare services.

41 lines (38 loc) 1.81 kB
import { S3Client } from '@aws-sdk/client-s3'; import { ProjectGraph, ProjectGraphProjectNode } from '@nx/devkit'; /** * Upload a file to a Cloudflare R2 bucket * * @param client - The S3 client configured for Cloudflare R2 * @param bucketName - The name of the R2 bucket * @param bucketPath - The path within the R2 bucket where the file will be uploaded * @param fileName - The name of the file to upload * @param version - The version metadata to associate with the file * @param fileContent - The content of the file to upload * @param contentType - The MIME type of the file content * @param isDryRun - Whether to perform a dry run without actual upload */ declare function uploadFile(client: S3Client, bucketName: string, bucketPath: string | undefined, fileName: string, version: string, fileContent: string, contentType?: string, isDryRun?: boolean): Promise<void>; /** * Get internal dependencies of a project from the project graph * * @param projectName - The name of the project * @param graph - The project graph * @returns An array of internal project nodes that are dependencies of the specified project */ declare function getInternalDependencies(projectName: string, graph: ProjectGraph): ProjectGraphProjectNode[]; /** * Determine if a MIME type represents a text file * * @param mimeType - The MIME type to check * @returns True if the MIME type represents a text file, false otherwise */ declare function isTextFile(mimeType: string): boolean; /** * Get the appropriate encoding for a given MIME type * * @param mimeType - The MIME type to evaluate * @returns The encoding string ("utf8" for text files, "binary" for others) */ declare function getEncoding(mimeType: string): BufferEncoding; export { getEncoding, getInternalDependencies, isTextFile, uploadFile };