Releases: jdlubrano/stream_lines
v0.4.1
v0.4.0
Adds support for encoding and handle invalid byte sequences #44
I am hoping that this is not a breaking change since the default encoding is used by default; however, I am not an expert on encodings. Thus I could have introduced something encoding-related that has unforeseen and undesirable consequences.
v0.3.1
- Fixes bug with null bytes within streams (#26)
I was seeing rather inexplicable behavior in a production application where null bytes were being added to the beginning of streamed lines. I was able to debug and observe that the StringIO
buffer would accumulate \u0000
bytes, but I have no idea why. In any case, initializing a new StringIO
instead of truncating seems to fix the issue.
v0.3.0
- Adds first-class support for streaming JSON lines (#18)
url = 'https://my.remote.file/file.jsonl'
stream = StreamLines::Reading::JSONLines.new(url)
stream.each do |row|
# each row will be an Hash
end
# Supports all Ruby JSON::parse options
stream = StreamLines::Reading::JSONLines.new(url, symbolize_names: true)
stream.each do |row|
# each row will be a Hash
end
v0.2.1
v0.2.0
Provides first-class support for streaming CSVs from a remote URL (#16).
url = 'https://my.remote.file/file.csv'
stream = StreamLines::Reading::CSV.new(url)
stream.each do |row|
# each row will be an array
end
# Supports most Ruby CSV options (see ignored options below)
stream = StreamLines::Reading::CSV.new(url, headers: true)
stream.each do |row|
# each row is a CSV::Row object that you can access like row['column_name']
end
Most options that you can pass to Ruby's CSV library are supported; however, the following options are explicitly ignored:
return_headers
header_converters
skip_lines
I suspect that these options are not used terribly frequently, and each would require additional logic in the StreamLines::Reading::CSV#each
method. Rather than attempting to implement sensible solutions for these options, I am choosing to explicitly ignore them until there is enough outcry to support them.