Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jtkDvlp/re-frame-readfile-fx

Repository files navigation

Clojars Project License: MIT

Readfile effect handler for re-frame

This re-frame library contains an FileReader-Object effect handler. The handler can be addressed by :readfile.

Changelog

2.0.0

  • Move package into ns jtk-dvlp.re-frame
  • Read files is a map of meta and content now.
  • Clean up project.clj
  • Move to figwheel-main for dev and test

Getting started

Get it / add dependency

Add the following dependency to your project.cljs:
Clojars Project

Usage

See the following minimal code example or the test.cljs.

(ns your.project
 (:require [re-frame.core :as re-frame]
 [jtk-dvlp.re-frame.readfile-fx]))
(re-frame/reg-event-fx
 :some-event
 (fn [_ [_ files]]
 {:readfile {;; vector of file- and / or blob-objects
 :files files
 ;; charset via string for all files,
 ;; via vector of strings for every single file
 ;; or nil for default (utf-8). nil also works
 ;; from within vector (for every single file)
 :charsets ["windows-1252" nil]
 ;; dispatched on success conjoined with read files
 :on-success [:your-success-event]
 ;; dispatched on error conjoined with read files
 :on-error [:your-error-event]}}))

How to get files from file-input see the test.cljs.

Appendix

I ́d be thankful to receive patches, comments and constructive criticism.

Hope the package is useful :-)

About

A re-frame effects handler for reading files via FileReader-Object

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /