func New(data []byte) (swarm.Chunk, error) {
	dataLength := len(data)
	if dataLength > swarm.ChunkSize {
		return nil, errTooLargeChunkData
	}

	if dataLength == 0 {
		return nil, errTooShortChunkData
	}

	span := make([]byte, swarm.SpanSize)
	binary.LittleEndian.PutUint64(span, uint64(dataLength))
	return newWithSpan(data, span)
}
// New creates a new content address chunk by initializing a span and appending the data to it.
New creates a new content address chunk by initializing a span and appending the data to it.
// New creates a new content address chunk by initializing a span and appending the data to it .
func New(data []byte) (swarm.Chunk, error) {
	dataLength := len(data)
	if dataLength > swarm.ChunkSize {
		return nil, errTooLargeChunkData
	}
	if dataLength == 0 {
		return nil, errTooShortChunkData
	}
	span := make([]byte, swarm.SpanSize)
	binary.LittleEndian.PutUint64(span, uint64(dataLength))
	return newWithSpan(data, span)
}
func New ( data [ ] byte ) ( swarm . Chunk , error ) { dataLength := len ( data ) if dataLength > swarm . ChunkSize { return nil , errTooLargeChunkData } if dataLength == 0 { return nil , errTooShortChunkData } span := make ( [ ] byte , swarm . SpanSize ) binary . LittleEndian . PutUint64 ( span , uint64 ( dataLength ) ) return newWithSpan ( data , span ) }
New creates a new content address chunk by initializing a span and appending the data to it.
New creates a new content address chunk by initializing a span and appending the data to it .