Liking cljdoc? Tell your friends :D

com.fulcrologic.rad.blob

Support for dealing with binary large objects (e.g. file upload, storage, and retrieval of images, documents, etc.)

To use this support you must:

  • Add wrap-persist-images from this ns to your form save middleware
  • Install the Fulcro Ring middleware file-upload/wrap-mutation-file-uploads.
  • Configure an HTTP remote on the client with file-upload/wrap-file-upload HTTP remote request middleware.
  • Add the and install the upload-file mutation from this ns into your pathom resolver.
  • Add ::blob/temporary-store to your Pathom env.
  • Add a ::blob/stores map to associate store names to Storage components to your Pathom env.
  • Configure attributes that will handle files. This support assumes some storage adapter will store the URL of the file uploaded, and the file data will go in some other store (e.g. S3, disk, etc.). So, you configure a to-one string attribute with: ** The form field style to use a renderer that supports file uploads. ** ::blob/store to indicate the identifer of an implementation of blob-storage/Storage.
Support for dealing with binary large objects (e.g. file upload, storage, and retrieval of images, documents, etc.)

To use this support you must:

- Add wrap-persist-images from this ns to your form save middleware
- Install the Fulcro Ring middleware `file-upload/wrap-mutation-file-uploads`.
- Configure an HTTP remote on the client with `file-upload/wrap-file-upload` HTTP remote request middleware.
- Add the and install the `upload-file` mutation from this ns into your pathom resolver.
- Add `::blob/temporary-store` to your Pathom env.
- Add a `::blob/stores` map to associate store names to Storage components to your Pathom env.
- Configure attributes that will handle files. This support assumes some storage adapter will store the URL
of the file uploaded, and the file data will go in some other store (e.g. S3, disk, etc.). So, you configure
a to-one string attribute with:
** The form field style to use a renderer that supports file uploads.
** ::blob/store to indicate the identifer of an implementation of blob-storage/Storage. 
raw docstring

Blobclj/s

source

blob-downloadable?clj/s

(blob-downloadable? form-props sha-key)

Returns true if the blob tracked by sha-key in the given form-props is in a state that would allow for a download.

Returns true if the blob tracked by `sha-key` in the given `form-props` is in a state that would allow for a download.
sourceraw docstring

blob-resolversclj

(blob-resolvers {:com.fulcrologic.rad.blob/keys [store]
                 :com.fulcrologic.rad.attributes/keys [qualified-key]
                 :as attribute})

Generates the extended blob resolvers for a given attribute.

Generates the extended blob resolvers for a given attribute.
sourceraw docstring

defblobattrclj/smacro

(defblobattr sym k remote-store-name fulcro-http-remote attribute-map)

Use this to create a Blob SHA (string) attribute that will track a file upload:

(defblobattr sha :file/sha :remote-file-store :remote
  {... normal attribute map ...})

The remote-file-store is the name of the store that the file will be stored in, and the fulcro-http-remote is the Fulcro client HTTP remote to use for the file transfer (which must be configured with the proper upload middleware on the client and server).

Use this to create a Blob SHA (string) attribute that will track a file upload:

```
(defblobattr sha :file/sha :remote-file-store :remote
  {... normal attribute map ...})
```

The `remote-file-store` is the name of the store that the file will be stored in, and the `fulcro-http-remote` is the Fulcro
client HTTP remote to use for the file transfer (which must be configured with the proper upload middleware on the
client and server).
sourceraw docstring

evt->js-filesclj/s

(evt->js-files evt)

Convert a file input change event into a sequence of the js File objects.

Convert a file input change event into a sequence of the js File objects.
sourceraw docstring

failed-upload?clj/s

(failed-upload? form-props sha-key)

Returns true of the blob tracked by sha-key failed to upload.

Returns true of the blob tracked by sha-key failed to upload.
sourceraw docstring

file-sha256clj/s

(file-sha256 blob)

Finds the SHA256 from the given Blob/File

Returns an async channel that will eventually contain the hash or nil (if the input type was not understood).

Finds the SHA256 from the given Blob/File

Returns an async channel that will eventually contain the hash or nil (if the input type was not understood).
sourceraw docstring

filename-keyclj/s

(filename-key k)
source

pathom-pluginclj

(pathom-plugin temporary-store permanent-stores)

A pathom plugin to configure blob stores.

  • temporary-store: A Storage object that is used to track temporary files between upload and final form save.
  • permanent-stores: A map from store name (keyword) to Storage objects that act as the permanent location for the file data.
A pathom plugin to configure blob stores.

- temporary-store: A Storage object that is used to track temporary files between upload and final form save.
- permanent-stores: A map from store name (keyword) to Storage objects that act as the permanent location for the
file data.
sourceraw docstring

progress-keyclj/s

(progress-key k)
source

resolversclj

(resolvers all-attributes)
source

sha256clj/s

(sha256 string-or-bytes)

Finds the SHA256 of the given string-or-bytes.

On the JVM the argument can be a string or a byte array. In CLJS the argument can be a low-level string, Uint8Array, ArrayBuffer.

Returns the hash or nil (if the input type was not understood).

Finds the SHA256 of the given string-or-bytes.

On the JVM the argument can be a string or a byte array.
In CLJS the argument can be a low-level string, Uint8Array, ArrayBuffer.

Returns the hash or nil (if the input type was not understood).
sourceraw docstring

size-keyclj/s

(size-key k)
source

status-keyclj/s

(status-key k)
source

ui-blobclj/s

source

upload-file!clj/s

(upload-file! form-instance
              {:com.fulcrologic.rad.blob/keys [remote]
               :com.fulcrologic.rad.attributes/keys [qualified-key]}
              js-file
              {:keys [file-ident]})

This computes a SHA for the js-file, starts the upload (with progress tracking), and sets the form attribute to the SHA. The narrowed attributes (e.g. :file.sha/progress) will be updated as the file upload progresses. The rendering layer will auto-detect when a file upload attribute is a SHA and can render the progress of the upload (possibly with a preview, etc.).

The upload can be aborted using the SHA.

This computes a SHA for the js-file, starts the upload (with progress tracking), and
sets the form attribute to the SHA. The narrowed attributes (e.g. :file.sha/progress) will be updated as the file
upload progresses. The rendering layer will auto-detect when a file upload attribute is a SHA
and can render the progress of the upload (possibly with a preview, etc.).

The upload can be aborted using the SHA.
sourceraw docstring

upload-percentageclj/s

(upload-percentage props sha-key)

Returns a string of the form "n%" which represents what percentage of the given blob identified by sha-key has made it to the server.

Returns a string of the form "n%" which represents what percentage of the given blob identified by
sha-key has made it to the server.
sourceraw docstring

uploading?clj/s

(uploading? form-props sha-key)

Returns true of the blob tracked by sha-key is actively being uploaded.

Returns true of the blob tracked by sha-key is actively being uploaded.
sourceraw docstring

url-keyclj/s

(url-key k)
source

wrap-blob-serviceclj

(wrap-blob-service handler base-path blob-store)

Middleware that can serve a blob-store file at URI base-path/SHA from blob-store. A query parameter of filename should be included in the request so that the user-visible filename is sent as that instead of the SHA.

Middleware that can serve a blob-store file at URI `base-path`/SHA from `blob-store`. A query parameter of `filename`
should be included in the request so that the user-visible filename is sent as that instead of the SHA.
sourceraw docstring

wrap-persist-imagesclj

(wrap-persist-images handler all-attributes)

Form save middleware that examines the incoming transaction for Blobs and moves them from temporary storage into a permanent store based on attribute configuration. This middleware requires you've also installed the Fulcro Ring middleware file-upload/wrap-mutation-file-uploads and configured an HTTP remote on the client with file-upload/wrap-file-upload HTTP remote request middleware. You must also use a form field that supports file uploads and install the upload-file mutation from this ns into your pathom resolver list.

Form save middleware that examines the incoming transaction for Blobs and moves them from temporary storage into
a permanent store based on attribute configuration. This middleware requires you've also installed the Fulcro
Ring middleware `file-upload/wrap-mutation-file-uploads` and configured an HTTP remote on the client with
`file-upload/wrap-file-upload` HTTP remote request middleware. You must also use a form field that supports file uploads
and install the `upload-file` mutation from this ns into your pathom resolver list.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close