Git Product home page Git Product logo

Comments (2)

rhubarb-geek-nz avatar rhubarb-geek-nz commented on June 12, 2024

Compare with proof of concept Split-Content

$foo = Split-Content -LiteralPath 'foo.bar' -AsByteStream -ReadCount 3

$foo.GetType().Name
$foo[0].GetType().Name
$foo.Count
$foo[0].Count
$foo[1].Count

Gives list of byte arrays

Object[]
Byte[]
2
3
3

from powershell.

mklement0 avatar mklement0 commented on June 12, 2024

I support this feature request, but let me add some context:

  • If -ReadCount is specified, -Raw is ignored (which is unfortunate, and arguably a bug).

  • -Raw in combination with -AsByteStream - but without -ReadCount - does emit a [byte[]] array, but it invariably means reading the whole input file into memory.

  • -ReadCount - wich currently emits [object[]] arrays - should:

    • emit [string[]] arrays by default
    • if -AsByteStream is also specified, should emit [byte[]] arrays

In other words: when "chunking" is requested via -ReadCount a strongly typed array should be returned, which helps performance, especially in v7.4+ with -AsByeStream, which then allows directly outputting chunked byte data to an external (native) program (which only works with [byte[]] arrays, not with [object[]] arrays).

This is technically a breaking change, but most likely one that falls into bucket 3.

from powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.