Skip to content

Commit

Permalink
Merge pull request #41 from queryverse/new-mime
Browse files Browse the repository at this point in the history
Add support for 'application/vnd.dataresource+json' MIME type
  • Loading branch information
davidanthoff authored Feb 4, 2019
2 parents 65ebaba + 8d2c2d9 commit eb00bb2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# CSVFiles.jl v0.14.0
* Add support for 'application/vnd.dataresource+json' MIME type

# CSVFiles.jl v0.13.0
* Never use StringVector, always use Vector{String} instead

Expand Down
12 changes: 12 additions & 0 deletions src/CSVFiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ end

Base.showable(::MIME"text/html", source::CSVFile) = true

function Base.show(io::IO, ::MIME"application/vnd.dataresource+json", source::CSVFile)
TableShowUtils.printdataresource(io, getiterator(source))
end

Base.showable(::MIME"application/vnd.dataresource+json", source::CSVFile) = true

function Base.show(io::IO, source::CSVStream)
TableShowUtils.printtable(io, getiterator(source), "CSV file")
end
Expand All @@ -38,6 +44,12 @@ end

Base.showable(::MIME"text/html", source::CSVStream) = true

function Base.show(io::IO, ::MIME"application/vnd.dataresource+json", source::CSVStream)
TableShowUtils.printdataresource(io, getiterator(source))
end

Base.showable(::MIME"application/vnd.dataresource+json", source::CSVStream) = true

function fileio_load(f::FileIO.File{FileIO.format"CSV"}, delim=','; args...)
return CSVFile(f.filename, delim, args)
end
Expand Down

0 comments on commit eb00bb2

Please sign in to comment.