# Subclassing FileAttachment for parsing fileInput

**URL:** <https://talk.observablehq.com/t/subclassing-fileattachment-for-parsing-fileinput/5449>\
**Category:** Help\
**Created:** [August 12, 2021, 1:20pm UTC](https://talk.observablehq.com/t/subclassing-fileattachment-for-parsing-fileinput/5449 "2021-08-12T13:20:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abitrolly](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/abitrolly/32/7214_2.png) [@abitrolly](https://talk.observablehq.com/u/abitrolly)\
**Post date:** [August 12, 2021, 1:20pm UTC](https://talk.observablehq.com/t/subclassing-fileattachment-for-parsing-fileinput/5449/1 "2021-08-12T13:20:11Z")

</div>

There is problem with [File Input with Initial Value / Mike Bostock / Observable](https://observablehq.com/@mbostock/file-input-with-initial-value) that if user selects own file, it is no longer possible to use `.csv` method to parse it, because the returned type would be `File` that doesn’t have these methods.

So I thought that maybe I can make some wrapper around `AbstractFile` from [stdlib/fileAttachment.js at e520f0db489e6c524baa2b2bdef267e19ef7c596 · observablehq/stdlib · GitHub](https://github.com/observablehq/stdlib/blob/e520f0db489e6c524baa2b2bdef267e19ef7c596/src/fileAttachment.js#L19) that takes `File` as an argumetn, but I can not understand how to import that.

Maybe it is already a solved problem, or there is a better solution to that?

---

<div class="post-metadata">

**Author:** ![tomlarkworthy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tomlarkworthy/32/5940_2.png) [@tomlarkworthy](https://talk.observablehq.com/u/tomlarkworthy)\
**Post date:** [August 12, 2021, 1:33pm UTC](https://talk.observablehq.com/t/subclassing-fileattachment-for-parsing-fileinput/5449/2 "2021-08-12T13:33:04Z")

</div>

yeah

> **[LocalFile](https://observablehq.com/@mbostock/localfile)**
>
> A hack to treat a local file as an Observable FileAttachment, so that you get all the same conveniences (e.g., loading CSV or SQLite).
