functional-cloudstorage v0.3.12
functional-cloudstorage
functional-cloudstorage
Index
Modules
Interfaces
functional-cloudstorage › "CloudStorage" › Config
Interface: Config
Hierarchy
- Config
Index
Properties
Properties
expires_in
• expires_in: number
Defined in src/CloudStorage.ts:37
file_type
• file_type: FileType
Defined in src/CloudStorage.ts:36
functional-cloudstorage › "CloudStorage" › ListFilesOptions
Interface: ListFilesOptions
Hierarchy
- ListFilesOptions
Index
Properties
Properties
Optional
delimiter
• delimiter? : string
Defined in src/CloudStorage.ts:42
Optional
prefix
• prefix? : string
Defined in src/CloudStorage.ts:41
functional-cloudstorage › "CloudStorage" › Metadata
Interface: Metadata
Hierarchy
- Metadata
Index
Properties
Properties
bucket
• bucket: string
Defined in src/CloudStorage.ts:51
contentType
• contentType: string
Defined in src/CloudStorage.ts:53
generation
• generation: string
Defined in src/CloudStorage.ts:52
id
• id: string
Defined in src/CloudStorage.ts:47
kind
• kind: string
Defined in src/CloudStorage.ts:46
mediaLink
• mediaLink: string
Defined in src/CloudStorage.ts:49
name
• name: string
Defined in src/CloudStorage.ts:50
selfLink
• selfLink: string
Defined in src/CloudStorage.ts:48
size
• size: string
Defined in src/CloudStorage.ts:54
timeCreated
• timeCreated: string
Defined in src/CloudStorage.ts:55
updated
• updated: string
Defined in src/CloudStorage.ts:56
functional-cloudstorage › "CloudStorage" › Path
Interface: Path
Hierarchy
- Path
Index
Properties
Properties
bucket
• bucket: string
Defined in src/CloudStorage.ts:31
filename
• filename: string
Defined in src/CloudStorage.ts:32
functional-cloudstorage › "Stubs" › ReturnValues
Interface: ReturnValues
Hierarchy
- ReturnValues
Index
Properties
Properties
buffer
• buffer: Buffer
Defined in src/Stubs.ts:12
url
• url: string
Defined in src/Stubs.ts:11
Modules
functional-cloudstorage › "Arbitraries"
Module: "Arbitraries"
Index
Functions
Functions
Const
bucket
▸ bucket(): Arbitrary‹SinonStubbedInstance‹Bucket››
Defined in src/Arbitraries.ts:41
Returns: Arbitrary‹SinonStubbedInstance‹Bucket››
Const
buffer
▸ buffer(): Arbitrary‹Buffer›
Defined in src/Arbitraries.ts:29
Returns: Arbitrary‹Buffer›
Const
config
▸ config(): Arbitrary‹Config›
Defined in src/Arbitraries.ts:14
Returns: Arbitrary‹Config›
Const
error
▸ error(): Arbitrary‹Error›
Defined in src/Arbitraries.ts:20
Returns: Arbitrary‹Error›
Const
file
▸ file(): Arbitrary‹SinonStubbedInstance‹File››
Defined in src/Arbitraries.ts:38
Returns: Arbitrary‹SinonStubbedInstance‹File››
Const
path
▸ path(): Arbitrary‹Path›
Defined in src/Arbitraries.ts:23
Returns: Arbitrary‹Path›
Const
returnValues
▸ returnValues(): Arbitrary‹ReturnValues›
Defined in src/Arbitraries.ts:32
Returns: Arbitrary‹ReturnValues›
Const
storage
▸ storage(arb?
: Arbitrary‹ReturnValues›): Arbitrary‹SinonStubbedInstance‹Storage››
Defined in src/Arbitraries.ts:44
Parameters:
Name | Type |
---|---|
arb? | Arbitrary‹ReturnValues› |
Returns: Arbitrary‹SinonStubbedInstance‹Storage››
functional-cloudstorage › "CloudStorage"
Module: "CloudStorage"
Index
Interfaces
Type aliases
Variables
- fetchFile
- fetchFileFromStorage
- getBufferFromFile
- getBufferFromStorage
- getBufferSingletonFromFile
- getFileFromStorage
- getSignedUrlArrayFromFileTask
- getUploadUrlFromFile
- getUploadUrlFromFileTask
- getUploadUrlFromStorage
- listFilesInBucket
- listFilesInStorage
- storeBufferToFile
- storeBufferToStorage
- storeMetadataToFile
- storeMetadataToStorage
Functions
- getBucketFromStorage
- getBufferSingletonFromFileTask
- getFileFromBucket
- getSignedUrlConfigFromConfig
- getSignedUrlTask
- getTaskEitherFromTask
- isPath
- storeBufferToFileTask
- storeMetadataToFileTask
Type aliases
FileType
Ƭ FileType: FileType.FileType
Defined in src/CloudStorage.ts:27
Variables
Const
fetchFile
• fetchFile: function = pipe( fetchFileTask, TEUtils.fromTask )
Defined in src/CloudStorage.ts:187
fetchFile :: File -> TaskEither File Error
Type declaration:
▸ (file
: File): TaskEither‹Error, File›
Parameters:
Name | Type |
---|---|
file | File |
Const
fetchFileFromStorage
• fetchFileFromStorage: function = pipe( getFileFromStorage, R.map(fetchFile) )
Defined in src/CloudStorage.ts:197
fetchFileFromStorage :: Storage -> ReaderTaskEither Path File Error
Type declaration:
▸ (storage
: Storage): ReaderTaskEither‹Path, Error, File›
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
getBufferFromFile
• getBufferFromFile: function = pipe( getBufferSingletonFromFile, TE.map(head as R.Reader<Buffer, Buffer>) )
Defined in src/CloudStorage.ts:242
getBufferFromFile :: File -> TaskEither Buffer Error
Type declaration:
▸ (file
: File): TaskEither‹Error, Buffer›
Parameters:
Name | Type |
---|---|
file | File |
Const
getBufferFromStorage
• getBufferFromStorage: function = pipe( getFileFromStorage, R.map(getBufferFromFile) )
Defined in src/CloudStorage.ts:254
getBufferFromStorage :: Storage -> ReaderTaskEither Path File Error
Type declaration:
▸ (storage
: Storage): ReaderTaskEither‹Path, Error, Buffer›
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
getBufferSingletonFromFile
• getBufferSingletonFromFile: function = pipe( getBufferSingletonFromFileTask, partialRight(TE.tryCatch, E.toError) )
Defined in src/CloudStorage.ts:230
getBufferSingletonFromFile :: File -> TaskEither [Buffer] Error
Type declaration:
▸ (file
: File): TaskEither‹Error, Buffer›
Parameters:
Name | Type |
---|---|
file | File |
Const
getFileFromStorage
• getFileFromStorage: function = pipe( getBucketFromStorageWithPath, R.chain(getFileFromBucket) )
Defined in src/CloudStorage.ts:163
getFileFromStorage :: Storage -> Reader Path File
Type declaration:
▸ (storage
: Storage): Reader‹Path, File›
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
getSignedUrlArrayFromFileTask
• getSignedUrlArrayFromFileTask: function = useWith(call, getSignedUrlTask, getSignedUrlConfigFromConfig, )
Defined in src/CloudStorage.ts:99
getSignedUrlArrayFromFileTask :: File -> ReaderTask Config [String]
Type declaration:
▸ (file
: File): Reader‹Config, Task‹string››
Parameters:
Name | Type |
---|---|
file | File |
Const
getUploadUrlFromFile
• getUploadUrlFromFile: function = pipe( getUploadUrlFromFileTask, R.map(getTaskEitherFromTask) )
Defined in src/CloudStorage.ts:132
getUploadUrlFromFile :: File -> ReaderTaskEither Config String Error
Type declaration:
▸ (file
: File): ReaderTaskEither‹Config, Error, string›
Parameters:
Name | Type |
---|---|
file | File |
Const
getUploadUrlFromFileTask
• getUploadUrlFromFileTask: function = pipe( getSignedUrlArrayFromFileTask, RT.map<string[], string>(head) )
Defined in src/CloudStorage.ts:111
getUploadUrlFromFileTask :: File -> ReaderTask Config String
Type declaration:
▸ (file
: File): ReaderTask‹Config, string›
Parameters:
Name | Type |
---|---|
file | File |
Const
getUploadUrlFromStorage
• getUploadUrlFromStorage: function = pipe( getFileFromStorage, R.map(getUploadUrlFromFile) )
Defined in src/CloudStorage.ts:209
getUploadUrlFromStorage :: Storage -> Path -> ReaderTaskEither Config String Error
Type declaration:
▸ (storage
: Storage): Reader‹Path, ReaderTaskEither‹Config, Error, string››
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
listFilesInBucket
• listFilesInBucket: function = pipe( listFilesInBucketTask, R.map(TEUtils.fromTask) )
Defined in src/CloudStorage.ts:366
listFilesInBucket :: Bucket -> ReaderTaskEither ListFilesOptions [File] Error
Type declaration:
▸ (bucket
: Bucket): ReaderTaskEither‹ListFilesOptions, Error, File[]›
Parameters:
Name | Type |
---|---|
bucket | Bucket |
Const
listFilesInStorage
• listFilesInStorage: function = pipe(getBucketFromStorage, R.map(listFilesInBucket))
Defined in src/CloudStorage.ts:378
listFilesInStorage :: Storage -> Reader String (ReaderTaskEither ListFilesOptions [File] Error)
Type declaration:
▸ (storage
: Storage): Reader‹string, ReaderTaskEither‹ListFilesOptions, Error, File[]››
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
storeBufferToFile
• storeBufferToFile: function = pipe( storeBufferToFileTask, R.map(getTaskEitherFromTask) )
Defined in src/CloudStorage.ts:280
storeBufferToFile :: File -> ReaderTaskEither Buffer File Error
Type declaration:
▸ (file
: File): ReaderTaskEither‹Buffer, Error, File›
Parameters:
Name | Type |
---|---|
file | File |
Const
storeBufferToStorage
• storeBufferToStorage: function = pipe( getFileFromStorage, R.map(storeBufferToFile) )
Defined in src/CloudStorage.ts:292
storeBufferToStorage :: Storage -> Reader Path ReaderTaskEither Buffer File Error
Type declaration:
▸ (storage
: Storage): Reader‹Path, ReaderTaskEither‹Buffer, Error, File››
Parameters:
Name | Type |
---|---|
storage | Storage |
Const
storeMetadataToFile
• storeMetadataToFile: function = pipe( storeMetadataToFileTask, R.map(getTaskEitherFromTask) )
Defined in src/CloudStorage.ts:318
storeMetadataToFile :: File -> ReaderTaskEither Metadata File Error
Type declaration:
▸ (file
: File): ReaderTaskEither‹Partial‹Metadata›, Error, File›
Parameters:
Name | Type |
---|---|
file | File |
Const
storeMetadataToStorage
• storeMetadataToStorage: function = pipe(getFileFromStorage, R.map(storeMetadataToFile))
Defined in src/CloudStorage.ts:330
storeMetadataToStorage :: Metadata -> Reader Path ReaderTaskEither Metadata File Error
Type declaration:
▸ (storage
: Storage): Reader‹Path, ReaderTaskEither‹Partial‹Metadata›, Error, File››
Parameters:
Name | Type |
---|---|
storage | Storage |
Functions
Const
getBucketFromStorage
▸ getBucketFromStorage(storage
: Storage‹›): (Anonymous function)
Defined in src/CloudStorage.ts:344
getBucketFromStorage :: Storage -> Reader String Bucket
Parameters:
Name | Type |
---|---|
storage | Storage‹› |
Returns: (Anonymous function)
Const
getBufferSingletonFromFileTask
▸ getBufferSingletonFromFileTask(file
: File‹›): (Anonymous function)
Defined in src/CloudStorage.ts:223
getBufferSingletonFromFilePromise :: File -> Task [Buffer]
Parameters:
Name | Type |
---|---|
file | File‹› |
Returns: (Anonymous function)
Const
getFileFromBucket
▸ getFileFromBucket(bucket
: Bucket‹›): (Anonymous function)
Defined in src/CloudStorage.ts:144
getFileFromBucket :: Bucket -> Reader Path File
Parameters:
Name | Type |
---|---|
bucket | Bucket‹› |
Returns: (Anonymous function)
Const
getSignedUrlConfigFromConfig
▸ getSignedUrlConfigFromConfig(__namedParameters
: object): object
Defined in src/CloudStorage.ts:76
getSignedUrlConfigFromConfig :: Config -> GetSignedUrlConfig
Parameters:
▪ __namedParameters: object
Name | Type |
---|---|
expiresIn | number |
fileType | "pdf" | "excel" | "json" | "png" | "jpeg" |
Returns: object
action: "write" = "write"
contentType: "application/pdf" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/json" | "image/png" | "image/jpeg" = FileType.toContentType(fileType)
expires: number = getUnixTimestampIn(expiresIn)
version: "v4" = "v4"
Const
getSignedUrlTask
▸ getSignedUrlTask(file
: File‹›): (Anonymous function)
Defined in src/CloudStorage.ts:90
getSignedUrlTask :: File -> ReaderTask GetSignedUrlConfig [String]
Parameters:
Name | Type |
---|---|
file | File‹› |
Returns: (Anonymous function)
Const
getTaskEitherFromTask
▸ getTaskEitherFromTask(task
: Task‹A›): TaskEither‹Error, A›
Defined in src/CloudStorage.ts:125
getTaskEitherFromTask :: Task -> TaskEither
Parameters:
Name | Type |
---|---|
task | Task‹A› |
Returns: TaskEither‹Error, A›
Const
isPath
▸ isPath(a
: unknown): a is Path
Defined in src/CloudStorage.ts:64
isPath :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is Path
Const
storeBufferToFileTask
▸ storeBufferToFileTask(file
: File‹›): (Anonymous function)
Defined in src/CloudStorage.ts:268
storeBufferToFileTask :: File -> ReaderTask Buffer File
Parameters:
Name | Type |
---|---|
file | File‹› |
Returns: (Anonymous function)
Const
storeMetadataToFileTask
▸ storeMetadataToFileTask(file
: File‹›): (Anonymous function)
Defined in src/CloudStorage.ts:306
storeMetadataToFileTask :: File -> ReaderTask Metadata File
Parameters:
Name | Type |
---|---|
file | File‹› |
Returns: (Anonymous function)
functional-cloudstorage › "DateTime"
Module: "DateTime"
Index
Functions
Functions
Const
getUnixTimestampIn
▸ getUnixTimestampIn(seconds
: number): number
Defined in src/DateTime.ts:6
getUnixTimestampInMinutes :: Int -> Int
Parameters:
Name | Type |
---|---|
seconds | number |
Returns: number
functional-cloudstorage › "index"
Module: "index"
Index
References
- Config
- FileType
- ListFilesOptions
- Metadata
- Path
- fetchFile
- fetchFileFromStorage
- getBucketFromStorage
- getBufferFromFile
- getBufferFromStorage
- getBufferSingletonFromFile
- getBufferSingletonFromFileTask
- getFileFromBucket
- getFileFromStorage
- getSignedUrlArrayFromFileTask
- getSignedUrlConfigFromConfig
- getSignedUrlTask
- getTaskEitherFromTask
- getUploadUrlFromFile
- getUploadUrlFromFileTask
- getUploadUrlFromStorage
- isPath
- listFilesInBucket
- listFilesInStorage
- storeBufferToFile
- storeBufferToFileTask
- storeBufferToStorage
- storeMetadataToFile
- storeMetadataToFileTask
- storeMetadataToStorage
References
Config
• Config:
FileType
• FileType:
ListFilesOptions
• ListFilesOptions:
Metadata
• Metadata:
Path
• Path:
fetchFile
• fetchFile:
fetchFileFromStorage
• fetchFileFromStorage:
getBucketFromStorage
• getBucketFromStorage:
getBufferFromFile
• getBufferFromFile:
getBufferFromStorage
• getBufferFromStorage:
getBufferSingletonFromFile
• getBufferSingletonFromFile:
getBufferSingletonFromFileTask
• getBufferSingletonFromFileTask:
getFileFromBucket
• getFileFromBucket:
getFileFromStorage
• getFileFromStorage:
getSignedUrlArrayFromFileTask
• getSignedUrlArrayFromFileTask:
getSignedUrlConfigFromConfig
• getSignedUrlConfigFromConfig:
getSignedUrlTask
• getSignedUrlTask:
getTaskEitherFromTask
• getTaskEitherFromTask:
getUploadUrlFromFile
• getUploadUrlFromFile:
getUploadUrlFromFileTask
• getUploadUrlFromFileTask:
getUploadUrlFromStorage
• getUploadUrlFromStorage:
isPath
• isPath:
listFilesInBucket
• listFilesInBucket:
listFilesInStorage
• listFilesInStorage:
storeBufferToFile
• storeBufferToFile:
storeBufferToFileTask
• storeBufferToFileTask:
storeBufferToStorage
• storeBufferToStorage:
storeMetadataToFile
• storeMetadataToFile:
storeMetadataToFileTask
• storeMetadataToFileTask:
storeMetadataToStorage
• storeMetadataToStorage:
functional-cloudstorage › "StorageObject"
Module: "StorageObject"
Index
Variables
- getBufferFromCloudStorage
- getFileNameFromStorageObject
- getFolderNameFromPath
- getFolderNameFromStorageObject
- getPathFromStorageObject
Functions
Variables
Const
getBufferFromCloudStorage
• getBufferFromCloudStorage: function = pipe( getFileFromCloudStorage, RTE.fromReaderEither, RTE.chainTaskEitherK(getBufferFromFile) )
Defined in src/StorageObject.ts:48
getBufferFromCloudStorage :: CloudStorage -> ReaderTaskEither StorageObject Buffer Error
Type declaration:
▸ (storage
: CloudStorage): ReaderTaskEither‹StorageObject, Error, Buffer›
Parameters:
Name | Type |
---|---|
storage | CloudStorage |
Const
getFileNameFromStorageObject
• getFileNameFromStorageObject: function = pipe(getFolderNameFromStorageObject, concat)
Defined in src/StorageObject.ts:81
getFileNameFromStorageObject :: StorageObject -> Reader String String
Type declaration:
▸ (object
: StorageObject): Reader‹string, string›
Parameters:
Name | Type |
---|---|
object | StorageObject |
Const
getFolderNameFromPath
• getFolderNameFromPath: function = pipe( split('/'), dropLast(1), join('/') )
Defined in src/StorageObject.ts:61
getFolderNameFromPath :: String -> String
Type declaration:
▸ (path
: string): string
Parameters:
Name | Type |
---|---|
path | string |
Const
getFolderNameFromStorageObject
• getFolderNameFromStorageObject: function = pipe(prop<string, string>('name'), getFolderNameFromPath)
Defined in src/StorageObject.ts:72
getFolderNameFromStorageObject :: StorageObject -> String
Type declaration:
▸ (object
: StorageObject): string
Parameters:
Name | Type |
---|---|
object | StorageObject |
Const
getPathFromStorageObject
• getPathFromStorageObject: function = pipe( E.fromPredicate( allPass(has('bucket'), has('name')), () => new Error('StorageObject missing properties "bucket" and "name".') ), E.map( (object: StorageObject): Path => ({ bucket: object.bucket, filename: object.name, }) ) )
Defined in src/StorageObject.ts:18
getPathFromStorageObject :: StorageObject -> Either Path Error
Type declaration:
▸ (object
: StorageObject): E.Either‹Error, Path›
Parameters:
Name | Type |
---|---|
object | StorageObject |
Functions
Const
getFileFromCloudStorage
▸ getFileFromCloudStorage(storage
: Storage‹›): function
Defined in src/StorageObject.ts:40
getFileFromCloudStorage :: CloudStorage -> ReaderTaskEither StorageObject File Error
Parameters:
Name | Type |
---|---|
storage | Storage‹› |
Returns: function
▸ (x0
: V0): T2
Parameters:
Name | Type |
---|---|
x0 | V0 |
Const
getPathFromFilePath
▸ getPathFromFilePath(bucket
: string): (Anonymous function)
Defined in src/StorageObject.ts:90
getPathFromFilePath :: String -> Reader String Path
Parameters:
Name | Type |
---|---|
bucket | string |
Returns: (Anonymous function)
Const
getPathWithNameFromBucket
▸ getPathWithNameFromBucket(bucket
: string): function
Defined in src/StorageObject.ts:104
getPathWithNameFromBucket :: String -> Reader StorageObject (Reader String Path)
Parameters:
Name | Type |
---|---|
bucket | string |
Returns: function
▸ (x0
: V0): T2
Parameters:
Name | Type |
---|---|
x0 | V0 |
functional-cloudstorage › "Stubs"
Module: "Stubs"
Index
Interfaces
Functions
Functions
Const
bucket
▸ bucket(values
: ReturnValues): object
Defined in src/Stubs.ts:59
Parameters:
Name | Type |
---|---|
values | ReturnValues |
Returns: object
Const
download
▸ download(buffer
: Buffer‹›): (Anonymous function)
Defined in src/Stubs.ts:23
Parameters:
Name | Type |
---|---|
buffer | Buffer‹› |
Returns: (Anonymous function)
Const
failedFile
▸ failedFile(error
: Error): object
Defined in src/Stubs.ts:48
Parameters:
Name | Type |
---|---|
error | Error |
Returns: object
Const
file
▸ file(values
: ReturnValues): object
Defined in src/Stubs.ts:37
Parameters:
Name | Type |
---|---|
values | ReturnValues |
Returns: object
Const
getFailedSignedUrl
▸ getFailedSignedUrl(error
: Error): (Anonymous function)
Defined in src/Stubs.ts:30
Parameters:
Name | Type |
---|---|
error | Error |
Returns: (Anonymous function)
Const
getSignedUrl
▸ getSignedUrl(url
: string): (Anonymous function)
Defined in src/Stubs.ts:18
Parameters:
Name | Type |
---|---|
url | string |
Returns: (Anonymous function)
Const
storage
▸ storage(values
: ReturnValues): object
Defined in src/Stubs.ts:74
Parameters:
Name | Type |
---|---|
values | ReturnValues |
Returns: object
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago